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();
}
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));
}
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);
}
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());
}
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));
}
Aggregations