use of com.yahoo.vespa.config.server.host.HostRegistry in project vespa by vespa-engine.
the class SessionPreparerTest method require_no_warning_for_overlapping_host_for_same_appid.
@Test
public void require_no_warning_for_overlapping_host_for_same_appid() throws IOException {
SessionContext ctx = getContext(getApplicationPackage(testApp));
((HostRegistry<ApplicationId>) ctx.getHostValidator()).update(applicationId("default"), Collections.singletonList("mytesthost"));
final StringBuilder logged = new StringBuilder();
DeployLogger logger = (level, message) -> {
System.out.println(level + ": " + message);
if (level.equals(LogLevel.WARNING) && message.contains("The host mytesthost is already in use"))
logged.append("ok");
};
preparer.prepare(ctx, logger, new PrepareParams.Builder().build(), Optional.empty(), tenantPath, Instant.now());
assertEquals(logged.toString(), "");
}
use of com.yahoo.vespa.config.server.host.HostRegistry in project vespa by vespa-engine.
the class LocalSessionTest method createSession.
private LocalSession createSession(TenantName tenant, long sessionId, SessionTest.MockSessionPreparer preparer, Optional<AllocatedHosts> allocatedHosts) throws Exception {
SessionZooKeeperClient zkc = new MockSessionZKClient(curator, tenant, sessionId, allocatedHosts);
zkc.createWriteStatusTransaction(Session.Status.NEW).commit();
ZooKeeperClient zkClient = new ZooKeeperClient(configCurator, new BaseDeployLogger(), false, Tenants.getSessionsPath(tenant).append(String.valueOf(sessionId)));
if (allocatedHosts.isPresent()) {
zkClient.write(allocatedHosts.get());
}
zkClient.write(Collections.singletonMap(Version.fromIntValues(0, 0, 0), new MockFileRegistry()));
File sessionDir = new File(tenantFileSystemDirs.sessionsPath(), String.valueOf(sessionId));
sessionDir.createNewFile();
return new LocalSession(tenant, sessionId, preparer, new SessionContext(FilesApplicationPackage.fromFile(testApp), zkc, sessionDir, new MemoryTenantApplications(), new HostRegistry<>(), superModelGenerationCounter));
}
Aggregations