Search in sources :

Example 1 with DeployTester

use of com.yahoo.vespa.config.server.deploy.DeployTester in project vespa by vespa-engine.

the class ConfigServerBootstrapTest method testBootStrapWhenRedeploymentFails.

@Test
public void testBootStrapWhenRedeploymentFails() throws Exception {
    ConfigserverConfig configserverConfig = createConfigserverConfig();
    DeployTester tester = new DeployTester("src/test/apps/hosted/", configserverConfig);
    tester.deployApp("myApp", "4.5.6", Instant.now());
    File versionFile = temporaryFolder.newFile();
    VersionState versionState = new VersionState(versionFile);
    assertTrue(versionState.isUpgraded());
    // Manipulate application package so that it will fail deployment when config server starts
    java.nio.file.Files.delete(Paths.get(configserverConfig.configServerDBDir()).resolve("tenants/").resolve(tester.tenant().getName().value()).resolve("sessions/2/services.xml"));
    RpcServer rpcServer = createRpcServer(configserverConfig);
    ConfigServerBootstrap bootstrap = new ConfigServerBootstrap(tester.applicationRepository(), rpcServer, versionState, createStateMonitor(), false);
    // Call method directly, to be sure that it is finished redeploying all applications and we can check status
    bootstrap.run();
    // App is invalid, so bootstrapping was unsuccessful. Status should be 'initializing' and rpc server should not be running
    assertEquals(StateMonitor.Status.initializing, bootstrap.status());
    assertFalse(rpcServer.isRunning());
}
Also used : ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) RpcServer(com.yahoo.vespa.config.server.rpc.RpcServer) DeployTester(com.yahoo.vespa.config.server.deploy.DeployTester) File(java.io.File) VersionState(com.yahoo.vespa.config.server.version.VersionState) Test(org.junit.Test)

Example 2 with DeployTester

use of com.yahoo.vespa.config.server.deploy.DeployTester in project vespa by vespa-engine.

the class ConfigServerBootstrapTest method testBootStrap.

@Test
// TODO: An issue with how MockCurator.MockLock is implemented make this not work (it will hang
@Ignore
public // not being able to acquire activate lock in ConfigServerBootstrap
void testBootStrap() throws Exception {
    ConfigserverConfig configserverConfig = createConfigserverConfig();
    DeployTester tester = new DeployTester("src/test/apps/hosted/", configserverConfig);
    tester.deployApp("myApp", "4.5.6", Instant.now());
    File versionFile = temporaryFolder.newFile();
    VersionState versionState = new VersionState(versionFile);
    assertTrue(versionState.isUpgraded());
    RpcServer rpcServer = createRpcServer(configserverConfig);
    ConfigServerBootstrap bootstrap = new ConfigServerBootstrap(tester.applicationRepository(), rpcServer, versionState, createStateMonitor());
    waitUntil(() -> bootstrap.status() == StateMonitor.Status.up, "failed waiting for status 'up'");
    waitUntil(rpcServer::isRunning, "failed waiting for Rpc server running");
    bootstrap.deconstruct();
    assertEquals(StateMonitor.Status.down, bootstrap.status());
    assertFalse(rpcServer.isRunning());
}
Also used : ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) RpcServer(com.yahoo.vespa.config.server.rpc.RpcServer) DeployTester(com.yahoo.vespa.config.server.deploy.DeployTester) File(java.io.File) VersionState(com.yahoo.vespa.config.server.version.VersionState) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)2 DeployTester (com.yahoo.vespa.config.server.deploy.DeployTester)2 RpcServer (com.yahoo.vespa.config.server.rpc.RpcServer)2 VersionState (com.yahoo.vespa.config.server.version.VersionState)2 File (java.io.File)2 Test (org.junit.Test)2 Ignore (org.junit.Ignore)1