summaryrefslogtreecommitdiffstats
path: root/configserver
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2021-02-18 13:02:19 +0100
committerJon Marius Venstad <venstad@gmail.com>2021-02-19 17:40:10 +0100
commit65cc474709ba5064995bd2553c5abc1cec435c14 (patch)
tree5223021fea6515c07ee4dd7048511ea5fd1df17b /configserver
parent4ad8737974a0476daabc7db37d615d4a73682682 (diff)
Test wiring through ZK (per app, and per session)
Diffstat (limited to 'configserver')
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java34
1 files changed, 32 insertions, 2 deletions
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java
index bb6c85961a5..231dcf728dd 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java
@@ -18,6 +18,7 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.DockerImage;
import com.yahoo.config.provision.Environment;
+import com.yahoo.config.provision.NodeResources;
import com.yahoo.config.provision.RegionName;
import com.yahoo.config.provision.Zone;
import com.yahoo.test.ManualClock;
@@ -49,8 +50,6 @@ import static com.yahoo.vespa.config.server.deploy.DeployTester.createFailingMod
import static com.yahoo.vespa.config.server.deploy.DeployTester.createHostedModelFactory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -416,6 +415,37 @@ public class HostedDeployTest {
tester.tenant().getApplicationRepo().database().readReindexingStatus(tester.applicationId()));
}
+ @Test
+ public void testDedicatedClusterControllerCluster() throws IOException {
+ DeployTester tester = new DeployTester.Builder()
+ .modelFactory(createHostedModelFactory())
+ .configserverConfig(createConfigserverConfig())
+ .hostProvisioner(new InMemoryProvisioner(7, new NodeResources(1, 4, 10, 0.3), false))
+ .build();
+ ApplicationId appId = tester.applicationId();
+
+ // Dedicated CCC is off until turned on.
+ tester.deployApp("src/test/apps/hosted/");
+ assertFalse(tester.applicationRepository().getActiveSession(appId).getMetaData().isInternalRedeploy());
+ assertEquals(4, tester.getAllocatedHostsOf(appId).getHosts().size());
+ assertFalse(tester.applicationRepository().getActiveSession(appId).getDedicatedClusterControllerCluster());
+
+ // Turn on dedicated CCC.
+ tester.applicationRepository().setDedicatedClusterControllerCluster(appId);
+ Optional<com.yahoo.config.provision.Deployment> deployment = tester.redeployFromLocalActive();
+ assertTrue(deployment.isPresent());
+ deployment.get().activate();
+ assertTrue(tester.applicationRepository().getActiveSession(appId).getMetaData().isInternalRedeploy());
+ assertEquals(7, tester.getAllocatedHostsOf(appId).getHosts().size());
+ assertTrue(tester.applicationRepository().getActiveSession(appId).getDedicatedClusterControllerCluster());
+
+ // Setting persists through new deployments.
+ tester.deployApp("src/test/apps/hosted/");
+ assertFalse(tester.applicationRepository().getActiveSession(appId).getMetaData().isInternalRedeploy());
+ assertEquals(7, tester.getAllocatedHostsOf(appId).getHosts().size());
+ assertTrue(tester.applicationRepository().getActiveSession(appId).getDedicatedClusterControllerCluster());
+ }
+
private ConfigserverConfig createConfigserverConfig() throws IOException {
return createConfigserverConfig(Zone.defaultZone());
}