summaryrefslogtreecommitdiffstats
path: root/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java')
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java
index e53f9270983..1fa7ceed755 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java
@@ -43,6 +43,7 @@ import com.yahoo.vespa.config.server.tenant.ContainerEndpointsCache;
import com.yahoo.vespa.config.server.tenant.EndpointCertificateMetadataStore;
import com.yahoo.vespa.config.server.tenant.EndpointCertificateRetriever;
import com.yahoo.vespa.config.server.zookeeper.ConfigCurator;
+import com.yahoo.vespa.config.util.ConfigUtils;
import com.yahoo.vespa.curator.mock.MockCurator;
import com.yahoo.vespa.flags.Flags;
import com.yahoo.vespa.flags.InMemoryFlagSource;
@@ -172,7 +173,7 @@ public class SessionPreparerTest {
HostRegistry<ApplicationId> hostValidator = new HostRegistry<>();
hostValidator.update(applicationId("foo"), Collections.singletonList("mytesthost"));
preparer.prepare(hostValidator, new BaseDeployLogger(), new PrepareParams.Builder().applicationId(applicationId("default")).build(),
- Optional.empty(), tenantPath, Instant.now(), app.getAppDir(), app, new SessionZooKeeperClient(curator, sessionsPath));
+ Optional.empty(), tenantPath, Instant.now(), app.getAppDir(), app, createSessionZooKeeperClient());
}
@Test
@@ -187,7 +188,7 @@ public class SessionPreparerTest {
hostValidator.update(applicationId, Collections.singletonList("mytesthost"));
preparer.prepare(hostValidator, logger, new PrepareParams.Builder().applicationId(applicationId).build(),
Optional.empty(), tenantPath, Instant.now(), app.getAppDir(), app,
- new SessionZooKeeperClient(curator, sessionsPath));
+ createSessionZooKeeperClient());
assertEquals(logged.toString(), "");
}
@@ -199,9 +200,8 @@ public class SessionPreparerTest {
.applicationName("foo").instanceName("quux").build();
PrepareParams params = new PrepareParams.Builder().applicationId(origId).build();
prepare(testApp, params);
- SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator, sessionsPath);
assertTrue(configCurator.exists(sessionsPath.append(SessionZooKeeperClient.APPLICATION_ID_PATH).getAbsolute()));
- assertThat(zkc.readApplicationId(), is(origId));
+ assertThat(createSessionZooKeeperClient().readApplicationId(), is(origId));
}
@Test
@@ -336,7 +336,7 @@ public class SessionPreparerTest {
FilesApplicationPackage applicationPackage = getApplicationPackage(app);
return preparer.prepare(new HostRegistry<>(), getLogger(), params,
Optional.empty(), tenantPath, Instant.now(), applicationPackage.getAppDir(),
- applicationPackage, new SessionZooKeeperClient(curator, sessionsPath));
+ applicationPackage, createSessionZooKeeperClient());
}
private FilesApplicationPackage getApplicationPackage(File testFile) throws IOException {
@@ -360,6 +360,10 @@ public class SessionPreparerTest {
ApplicationName.from(applicationName), InstanceName.defaultName());
}
+ private SessionZooKeeperClient createSessionZooKeeperClient() {
+ return new SessionZooKeeperClient(curator, configCurator, sessionsPath, ConfigUtils.getCanonicalHostName());
+ }
+
private static class FailWithTransientExceptionProvisioner implements Provisioner {
@Override