summaryrefslogtreecommitdiffstats
path: root/orchestrator/src
diff options
context:
space:
mode:
Diffstat (limited to 'orchestrator/src')
-rw-r--r--orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/VespaModelUtil.java6
-rw-r--r--orchestrator/src/test/java/com/yahoo/vespa/orchestrator/TestUtil.java8
-rw-r--r--orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/VespaModelUtilTest.java20
-rw-r--r--orchestrator/src/test/java/com/yahoo/vespa/orchestrator/policy/HostedVespaPolicyTest.java6
4 files changed, 28 insertions, 12 deletions
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/VespaModelUtil.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/VespaModelUtil.java
index a362d7710a9..c94ce8cacdb 100644
--- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/VespaModelUtil.java
+++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/VespaModelUtil.java
@@ -197,10 +197,12 @@ public class VespaModelUtil {
}
// See getClusterControllerIndex()
- private static final Pattern CONTROLLER_INDEX_PATTERN = Pattern.compile("admin/cluster-controllers/(\\d+)");
+ private static final Pattern CONTROLLER_INDEX_PATTERN = Pattern.compile(".*-controllers/(\\d+)");
/**
- * @param configId Must be of the form admin/cluster-controllers/2
+ * @param configId Must be of the form admin/cluster-controllers/2 or NAME/standalone/NAME-controllers/2,
+ * where NAME is the name of the content cluster. NAME-controllers is also the cluster ID of
+ * the cluster controller cluster.
* @return the Cluster Controller index given its config ID.
* @throws java.lang.IllegalArgumentException if the config ID is not of the proper format.
*/
diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/TestUtil.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/TestUtil.java
index c91b629f111..0f074be9667 100644
--- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/TestUtil.java
+++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/TestUtil.java
@@ -27,11 +27,11 @@ public class TestUtil {
return new HashSet<>(Arrays.asList(serviceClusters));
}
- public static ConfigId storageNodeConfigId(int index) {
- return new ConfigId("storage/storage/" + index);
+ public static ConfigId storageNodeConfigId(String contentClusterName, int index) {
+ return new ConfigId(contentClusterName + "/storage/" + index);
}
- public static ConfigId clusterControllerConfigId(int index) {
- return new ConfigId("admin/cluster-controllers/" + index);
+ public static ConfigId clusterControllerConfigId(String contentClusterName, int index) {
+ return new ConfigId(contentClusterName + "/standalone/" + contentClusterName + "-controllers/" + index);
}
}
diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/VespaModelUtilTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/VespaModelUtilTest.java
index f2c17299d39..ea4b095a748 100644
--- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/VespaModelUtilTest.java
+++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/VespaModelUtilTest.java
@@ -24,6 +24,7 @@ import static com.yahoo.vespa.orchestrator.TestUtil.makeServiceInstanceSet;
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;
import static org.fest.assertions.Assertions.assertThat;
+import static org.junit.Assert.fail;
/**
* @author hakonhall
@@ -36,11 +37,11 @@ public class VespaModelUtilTest {
public static final HostName controller0Host = new HostName("controller-0");
private static final ServiceInstance<ServiceMonitorStatus> controller0 = new ServiceInstance<>(
- TestUtil.clusterControllerConfigId(0),
+ TestUtil.clusterControllerConfigId(CONTENT_CLUSTER_ID.toString(), 0),
controller0Host,
ServiceMonitorStatus.UP);
private static final ServiceInstance<ServiceMonitorStatus> controller1 = new ServiceInstance<>(
- TestUtil.clusterControllerConfigId(1),
+ TestUtil.clusterControllerConfigId(CONTENT_CLUSTER_ID.toString(), 1),
new HostName("controller-1"),
ServiceMonitorStatus.UP);
@@ -216,8 +217,21 @@ public class VespaModelUtilTest {
}
@Test
+ public void testGetClusterControllerIndexWithStandaloneClusterController() {
+ ConfigId configId = new ConfigId("fantasy_sports/standalone/fantasy_sports-controllers/1");
+ assertThat(VespaModelUtil.getClusterControllerIndex(configId)).isEqualTo(1);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testBadClusterControllerConfigId() {
+ ConfigId configId = new ConfigId("fantasy_sports/storage/9");
+ VespaModelUtil.getClusterControllerIndex(configId);
+ fail();
+ }
+
+ @Test
public void testGetStorageNodeIndex() {
- ConfigId configId = TestUtil.storageNodeConfigId(3);
+ ConfigId configId = TestUtil.storageNodeConfigId(CONTENT_CLUSTER_ID.toString(), 3);
assertThat(VespaModelUtil.getStorageNodeIndex(configId)).isEqualTo(3);
}
}
diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/policy/HostedVespaPolicyTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/policy/HostedVespaPolicyTest.java
index 55de50299b3..5cba6375717 100644
--- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/policy/HostedVespaPolicyTest.java
+++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/policy/HostedVespaPolicyTest.java
@@ -405,7 +405,7 @@ public class HostedVespaPolicyTest {
VespaModelUtil.CLUSTER_CONTROLLER_SERVICE_TYPE,
makeServiceInstanceSet(
new ServiceInstance<>(
- TestUtil.clusterControllerConfigId(0),
+ TestUtil.clusterControllerConfigId(CONTENT_CLUSTER_NAME, 0),
CLUSTER_CONTROLLER_HOST,
UP)));
@@ -423,7 +423,7 @@ public class HostedVespaPolicyTest {
VespaModelUtil.STORAGENODE_SERVICE_TYPE,
makeServiceInstanceSet(
new ServiceInstance<>(
- TestUtil.storageNodeConfigId(STORAGE_NODE_INDEX),
+ TestUtil.storageNodeConfigId(CONTENT_CLUSTER_NAME, STORAGE_NODE_INDEX),
STORAGE_NODE_HOST,
UP)));
@@ -793,7 +793,7 @@ public class HostedVespaPolicyTest {
private final Set<ServiceInstance<ServiceMonitorStatus>> instances = new HashSet<>();
public StorageClusterBuilder instance(final HostName hostName, final ServiceMonitorStatus status, int index) {
- instances.add(new ServiceInstance<>(TestUtil.storageNodeConfigId(index), hostName, status));
+ instances.add(new ServiceInstance<>(TestUtil.storageNodeConfigId("content", index), hostName, status));
return this;
}