Search in sources :

Example 6 with ConfigserverConfig

use of com.yahoo.cloud.config.ConfigserverConfig 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 7 with ConfigserverConfig

use of com.yahoo.cloud.config.ConfigserverConfig in project vespa by vespa-engine.

the class InjectedGlobalComponentRegistryTest method setupRegistry.

@Before
public void setupRegistry() {
    curator = new MockCurator();
    ConfigCurator configCurator = ConfigCurator.create(curator);
    metrics = Metrics.createTestMetrics();
    modelFactoryRegistry = new ModelFactoryRegistry(Collections.singletonList(new VespaModelFactory(new NullConfigModelRegistry())));
    configserverConfig = new ConfigserverConfig(new ConfigserverConfig.Builder().configServerDBDir(Files.createTempDir().getAbsolutePath()).configDefinitionsDir(Files.createTempDir().getAbsolutePath()));
    serverDB = new ConfigServerDB(configserverConfig);
    sessionPreparer = new SessionTest.MockSessionPreparer();
    rpcServer = new RpcServer(configserverConfig, null, Metrics.createTestMetrics(), new HostRegistries(), new ConfigRequestHostLivenessTracker(), new FileServer(FileDistribution.getDefaultFileDBPath()));
    generationCounter = new SuperModelGenerationCounter(curator);
    defRepo = new StaticConfigDefinitionRepo();
    permanentApplicationPackage = new PermanentApplicationPackage(configserverConfig);
    hostRegistries = new HostRegistries();
    HostProvisionerProvider hostProvisionerProvider = HostProvisionerProvider.withProvisioner(new SessionHandlerTest.MockProvisioner());
    zone = Zone.defaultZone();
    globalComponentRegistry = new InjectedGlobalComponentRegistry(curator, configCurator, metrics, modelFactoryRegistry, serverDB, sessionPreparer, rpcServer, configserverConfig, generationCounter, defRepo, permanentApplicationPackage, hostRegistries, hostProvisionerProvider, zone);
}
Also used : ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) HostRegistries(com.yahoo.vespa.config.server.host.HostRegistries) HostProvisionerProvider(com.yahoo.vespa.config.server.provision.HostProvisionerProvider) ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry) ConfigRequestHostLivenessTracker(com.yahoo.vespa.config.server.host.ConfigRequestHostLivenessTracker) VespaModelFactory(com.yahoo.vespa.model.VespaModelFactory) NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) ConfigCurator(com.yahoo.vespa.config.server.zookeeper.ConfigCurator) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest) RpcServer(com.yahoo.vespa.config.server.rpc.RpcServer) PermanentApplicationPackage(com.yahoo.vespa.config.server.application.PermanentApplicationPackage) FileServer(com.yahoo.vespa.config.server.filedistribution.FileServer) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Before(org.junit.Before)

Example 8 with ConfigserverConfig

use of com.yahoo.cloud.config.ConfigserverConfig in project vespa by vespa-engine.

the class SuperModelRequestHandlerTest method test_super_model_master_generation.

@Test
public void test_super_model_master_generation() throws IOException, SAXException {
    TenantName tenantA = TenantName.from("a");
    long masterGen = 10;
    ConfigserverConfig configserverConfig = new ConfigserverConfig(new ConfigserverConfig.Builder().masterGeneration(masterGen));
    manager = new SuperModelManager(configserverConfig, emptyNodeFlavors(), counter);
    controller = new SuperModelRequestHandler(new TestConfigDefinitionRepo(), configserverConfig, manager);
    long gen = counter.increment();
    controller.reloadConfig(tenantA, createApp(tenantA, "foo", 3L, 1));
    assertThat(controller.getHandler().getGeneration(), is(masterGen + gen));
}
Also used : ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) TenantName(com.yahoo.config.provision.TenantName) Test(org.junit.Test)

Example 9 with ConfigserverConfig

use of com.yahoo.cloud.config.ConfigserverConfig in project vespa by vespa-engine.

the class VersionStateTest method serverdbfile.

@Test
public void serverdbfile() throws IOException {
    File dbDir = tempDir.newFolder();
    VersionState state = new VersionState(new ConfigserverConfig(new ConfigserverConfig.Builder().configServerDBDir(dbDir.getAbsolutePath())));
    state.saveNewVersion();
    File versionFile = new File(dbDir, "vespa_version");
    assertTrue(versionFile.exists());
    Version stored = Version.fromString(IOUtils.readFile(versionFile));
    assertThat(stored, is(state.currentVersion()));
}
Also used : ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) Version(com.yahoo.config.provision.Version) File(java.io.File) Test(org.junit.Test)

Example 10 with ConfigserverConfig

use of com.yahoo.cloud.config.ConfigserverConfig in project vespa by vespa-engine.

the class StateResourceTest method setUp.

@Before
public void setUp() throws Exception {
    UriInfo base = Mockito.mock(UriInfo.class);
    Mockito.when(base.getBaseUri()).thenReturn(new URI(EXTERNAL_BASE_URI));
    ConfigServerLocation dummyLocation = new ConfigServerLocation(new ConfigserverConfig(new ConfigserverConfig.Builder()));
    testResource = new TestResource(dummyLocation, base);
    correspondingModel = new ServiceModel(ServiceModelTest.syntheticModelResponse());
}
Also used : ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) URI(java.net.URI) UriInfo(javax.ws.rs.core.UriInfo) Before(org.junit.Before)

Aggregations

ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)23 Test (org.junit.Test)16 File (java.io.File)4 RpcServer (com.yahoo.vespa.config.server.rpc.RpcServer)3 Before (org.junit.Before)3 Zone (com.yahoo.config.provision.Zone)2 PermanentApplicationPackage (com.yahoo.vespa.config.server.application.PermanentApplicationPackage)2 DeployTester (com.yahoo.vespa.config.server.deploy.DeployTester)2 FileServer (com.yahoo.vespa.config.server.filedistribution.FileServer)2 HostRegistries (com.yahoo.vespa.config.server.host.HostRegistries)2 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)2 VersionState (com.yahoo.vespa.config.server.version.VersionState)2 MockCurator (com.yahoo.vespa.curator.mock.MockCurator)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ComponentRegistry (com.yahoo.component.provider.ComponentRegistry)1 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)1 DeployProperties (com.yahoo.config.model.deploy.DeployProperties)1 DeployState (com.yahoo.config.model.deploy.DeployState)1 MockRoot (com.yahoo.config.model.test.MockRoot)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1