Search in sources :

Example 16 with MockCurator

use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.

the class SessionActiveHandlerTest method setup.

@Before
public void setup() throws Exception {
    remoteSessionRepo = new RemoteSessionRepo(tenant);
    applicationRepo = new MemoryTenantApplications();
    curator = new MockCurator();
    configCurator = ConfigCurator.create(curator);
    localRepo = new LocalSessionRepo(Clock.systemUTC());
    pathPrefix = "/application/v2/tenant/" + tenant + "/session/";
    hostProvisioner = new MockProvisioner();
    modelFactory = new VespaModelFactory(new NullConfigModelRegistry());
    componentRegistry = new TestComponentRegistry.Builder().curator(curator).configCurator(configCurator).modelFactoryRegistry(new ModelFactoryRegistry(Collections.singletonList(modelFactory))).build();
}
Also used : VespaModelFactory(com.yahoo.vespa.model.VespaModelFactory) RemoteSessionRepo(com.yahoo.vespa.config.server.session.RemoteSessionRepo) NullConfigModelRegistry(com.yahoo.config.model.NullConfigModelRegistry) MemoryTenantApplications(com.yahoo.vespa.config.server.application.MemoryTenantApplications) LocalSessionRepo(com.yahoo.vespa.config.server.session.LocalSessionRepo) TestComponentRegistry(com.yahoo.vespa.config.server.TestComponentRegistry) ModelFactoryRegistry(com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Before(org.junit.Before)

Example 17 with MockCurator

use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.

the class SessionActiveHandlerTest method testActivationWithBarrierTimeout.

@Test
public void testActivationWithBarrierTimeout() throws Exception {
    // Needed so we can test that previous active session is still active after a failed activation
    activateAndAssertOK(90l, 0l, Clock.systemUTC());
    ((MockCurator) curator).timeoutBarrierOnEnter(true);
    ActivateRequest activateRequest = new ActivateRequest(91l, 90l, "", Clock.systemUTC()).invoke();
    HttpResponse actResponse = activateRequest.getActResponse();
    assertThat(actResponse.getStatus(), Is.is(INTERNAL_SERVER_ERROR));
}
Also used : HttpResponse(com.yahoo.container.jdisc.HttpResponse) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) HandlerTest(com.yahoo.vespa.config.server.http.HandlerTest) SessionHandlerTest(com.yahoo.vespa.config.server.http.SessionHandlerTest) SessionTest(com.yahoo.vespa.config.server.session.SessionTest) Test(org.junit.Test)

Example 18 with MockCurator

use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.

the class SuperModelRequestHandlerTest method setup.

@Before
public void setup() throws IOException {
    counter = new SuperModelGenerationCounter(new MockCurator());
    ConfigserverConfig configserverConfig = new ConfigserverConfig(new ConfigserverConfig.Builder());
    manager = new SuperModelManager(configserverConfig, emptyNodeFlavors(), counter);
    controller = new SuperModelRequestHandler(new TestConfigDefinitionRepo(), configserverConfig, manager);
}
Also used : ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Before(org.junit.Before)

Example 19 with MockCurator

use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.

the class ZooKeeperClientTest method testWritingHostNamesToZooKeeper.

@Test
public void testWritingHostNamesToZooKeeper() throws IOException {
    ConfigCurator zk = ConfigCurator.create(new MockCurator());
    BaseDeployLogger logger = new BaseDeployLogger();
    Path app = Path.fromString("/1");
    ZooKeeperClient zooKeeperClient = new ZooKeeperClient(zk, logger, true, app);
    zooKeeperClient.setupZooKeeper();
    HostSpec host1 = new HostSpec("host1.yahoo.com", Collections.emptyList());
    HostSpec host2 = new HostSpec("host2.yahoo.com", Collections.emptyList());
    ImmutableSet<HostSpec> hosts = ImmutableSet.of(host1, host2);
    zooKeeperClient.write(AllocatedHosts.withHosts(hosts));
    Path hostsPath = app.append(ZKApplicationPackage.allocatedHostsNode);
    assertTrue(zk.exists(hostsPath.getAbsolute()));
    AllocatedHosts deserialized = AllocatedHosts.fromJson(zk.getBytes(hostsPath.getAbsolute()), Optional.empty());
    assertEquals(hosts, deserialized.getHosts());
}
Also used : Path(com.yahoo.path.Path) ConfigCurator(com.yahoo.vespa.config.server.zookeeper.ConfigCurator) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Test(org.junit.Test)

Example 20 with MockCurator

use of com.yahoo.vespa.curator.mock.MockCurator in project vespa by vespa-engine.

the class CuratorCompletionWaiterTest method testCompletionWaiterFailure.

@Test(expected = CompletionTimeoutException.class)
public void testCompletionWaiterFailure() {
    Curator curator = new MockCurator();
    Curator.CompletionWaiter waiter = CuratorCompletionWaiter.createAndInitialize(curator, Path.createRoot(), "foo", 1, "foo");
    waiter.awaitCompletion(Duration.ofMillis(100));
}
Also used : MockCurator(com.yahoo.vespa.curator.mock.MockCurator) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Test(org.junit.Test)

Aggregations

MockCurator (com.yahoo.vespa.curator.mock.MockCurator)29 Test (org.junit.Test)16 Before (org.junit.Before)11 Curator (com.yahoo.vespa.curator.Curator)6 ConfigCurator (com.yahoo.vespa.config.server.zookeeper.ConfigCurator)5 MockNameResolver (com.yahoo.vespa.hosted.provision.testutils.MockNameResolver)5 DockerImage (com.yahoo.config.provision.DockerImage)4 NodeRepository (com.yahoo.vespa.hosted.provision.NodeRepository)4 File (java.io.File)4 NullConfigModelRegistry (com.yahoo.config.model.NullConfigModelRegistry)3 NodeFlavors (com.yahoo.config.provision.NodeFlavors)3 Zone (com.yahoo.config.provision.Zone)3 Path (com.yahoo.path.Path)3 ModelFactoryRegistry (com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry)3 VespaModelFactory (com.yahoo.vespa.model.VespaModelFactory)3 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)2 ManualClock (com.yahoo.test.ManualClock)2 TestComponentRegistry (com.yahoo.vespa.config.server.TestComponentRegistry)2 MemoryTenantApplications (com.yahoo.vespa.config.server.application.MemoryTenantApplications)2 SessionHandlerTest (com.yahoo.vespa.config.server.http.SessionHandlerTest)2