summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2020-06-24 18:34:50 +0200
committerGitHub <noreply@github.com>2020-06-24 18:34:50 +0200
commit8a3502f7f399c3891f83d61452af9999e838ca6b (patch)
tree5bf64bd29712d89f25834bb47b44e39302ffd7e0
parent6821733667528dddeed658205358f6b9dda12090 (diff)
parentfcc44803ad12c6a4be9e5eec268114744d32c940 (diff)
Merge pull request #13690 from vespa-engine/hmusum/configserver-refactoring-15
Config server refactoring, part 15, simplify tenant code
-rw-r--r--configdefinitions/src/vespa/configserver.def1
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java8
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/TenantsMaintainer.java16
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenant.java26
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java43
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java30
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/MaintainerTester.java9
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/TenantsMaintainerTest.java8
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/tenant/TenantRepositoryTest.java19
9 files changed, 66 insertions, 94 deletions
diff --git a/configdefinitions/src/vespa/configserver.def b/configdefinitions/src/vespa/configserver.def
index 88a637e3ecb..26051c7ff9d 100644
--- a/configdefinitions/src/vespa/configserver.def
+++ b/configdefinitions/src/vespa/configserver.def
@@ -63,7 +63,6 @@ sleepTimeWhenRedeployingFails long default=30
# Features (to be overridden in configserver-config.xml if needed)
buildMinimalSetOfConfigModels bool default=true
-throwIfBootstrappingTenantRepoFails bool default=true
# Unused, remove in Vespa 8
throwIfActiveSessionCannotBeLoaded bool default=true
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
index becf01c191c..3eb00a0adef 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
@@ -59,6 +59,7 @@ import com.yahoo.vespa.config.server.tenant.ContainerEndpointsCache;
import com.yahoo.vespa.config.server.tenant.EndpointCertificateMetadataStore;
import com.yahoo.vespa.config.server.tenant.Tenant;
import com.yahoo.vespa.config.server.tenant.TenantRepository;
+import com.yahoo.vespa.curator.Curator;
import com.yahoo.vespa.curator.Lock;
import com.yahoo.vespa.orchestrator.Orchestrator;
@@ -389,11 +390,12 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
}
NestedTransaction transaction = new NestedTransaction();
- transaction.add(new ContainerEndpointsCache(tenant.getPath(), tenant.getCurator()).delete(applicationId)); // TODO: Not unit tested
+ Curator curator = tenantRepository.getCurator();
+ transaction.add(new ContainerEndpointsCache(tenant.getPath(), curator).delete(applicationId)); // TODO: Not unit tested
// Delete any application roles
- transaction.add(new ApplicationRolesStore(tenant.getCurator(), tenant.getPath()).delete(applicationId));
+ transaction.add(new ApplicationRolesStore(curator, tenant.getPath()).delete(applicationId));
// Delete endpoint certificates
- transaction.add(new EndpointCertificateMetadataStore(tenant.getCurator(), tenant.getPath()).delete(applicationId));
+ transaction.add(new EndpointCertificateMetadataStore(curator, tenant.getPath()).delete(applicationId));
// (When rotations are updated in zk, we need to redeploy the zone app, on the right config server
// this is done asynchronously in application maintenance by the node repository)
transaction.add(tenantApplications.createDeleteTransaction(applicationId));
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/TenantsMaintainer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/TenantsMaintainer.java
index b3c67859098..d3865f287cd 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/TenantsMaintainer.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/TenantsMaintainer.java
@@ -4,8 +4,8 @@ package com.yahoo.vespa.config.server.maintenance;
import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.curator.Curator;
+import java.time.Clock;
import java.time.Duration;
-import java.time.Instant;
/**
* Removes unused tenants (has no applications and was created more than 7 days ago)
@@ -14,19 +14,19 @@ import java.time.Instant;
*/
public class TenantsMaintainer extends ConfigServerMaintainer {
- private final Duration ttlForUnusedTenant;
+ static final Duration defaultTtlForUnusedTenant = Duration.ofDays(7);
- TenantsMaintainer(ApplicationRepository applicationRepository, Curator curator, Duration interval) {
- this(applicationRepository, curator, interval, Duration.ofDays(7));
- }
+ private final Duration ttlForUnusedTenant;
+ private final Clock clock;
- private TenantsMaintainer(ApplicationRepository applicationRepository, Curator curator, Duration interval, Duration ttlForUnusedTenant) {
+ TenantsMaintainer(ApplicationRepository applicationRepository, Curator curator, Duration interval, Clock clock) {
super(applicationRepository, curator, interval, interval);
- this.ttlForUnusedTenant = ttlForUnusedTenant;
+ this.ttlForUnusedTenant = defaultTtlForUnusedTenant;
+ this.clock = clock;
}
@Override
protected void maintain() {
- applicationRepository.deleteUnusedTenants(ttlForUnusedTenant, Instant.now());
+ applicationRepository.deleteUnusedTenants(ttlForUnusedTenant, clock.instant());
}
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenant.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenant.java
index bf0601bf2f1..7a9a4f950b5 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenant.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/Tenant.java
@@ -6,11 +6,8 @@ import com.yahoo.path.Path;
import com.yahoo.vespa.config.server.RequestHandler;
import com.yahoo.vespa.config.server.application.TenantApplications;
import com.yahoo.vespa.config.server.session.SessionRepository;
-import com.yahoo.vespa.curator.Curator;
-import org.apache.zookeeper.data.Stat;
import java.time.Instant;
-import java.util.Optional;
/**
* Contains all tenant-level components for a single tenant, dealing with editing sessions and
@@ -29,19 +26,19 @@ public class Tenant implements TenantHandlerProvider {
private final SessionRepository sessionRepository;
private final TenantApplications applicationRepo;
private final RequestHandler requestHandler;
- private final Curator curator;
+ private final Instant created;
Tenant(TenantName name,
SessionRepository sessionRepository,
RequestHandler requestHandler,
TenantApplications applicationRepo,
- Curator curator) {
+ Instant created) {
this.name = name;
this.path = TenantRepository.getTenantPath(name);
this.requestHandler = requestHandler;
this.sessionRepository = sessionRepository;
this.applicationRepo = applicationRepo;
- this.curator = curator;
+ this.created = created;
}
/**
@@ -72,16 +69,8 @@ public class Tenant implements TenantHandlerProvider {
return applicationRepo;
}
- public Curator getCurator() {
- return curator;
- }
-
public Instant getCreatedTime() {
- Optional<Stat> stat = curator.getStat(path);
- if (stat.isPresent())
- return Instant.ofEpochMilli(stat.get().getCtime());
- else
- return Instant.now();
+ return created;
}
@Override
@@ -101,16 +90,11 @@ public class Tenant implements TenantHandlerProvider {
/**
* Closes any watchers, thread pools that may react to changes in tenant state,
* and removes any session data in filesystem and zookeeper.
- * Called by watchers as a reaction to {@link #delete()}.
+ * Called by watchers as a reaction to deleting a tenant.
*/
void close() {
applicationRepo.close(); // Closes watchers.
sessionRepository.close(); // Closes watchers, clears memory, and deletes local files and ZK session state.
}
- /** Deletes the tenant tree from ZooKeeper (application and session status for the tenant) and triggers {@link #close()}. */
- void delete() {
- curator.delete(path); // Deletes tenant ZK tree: applications and sessions.
- }
-
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java
index 2c9d9bf239c..5afb99e81e3 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java
@@ -20,8 +20,10 @@ import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
import org.apache.curator.framework.state.ConnectionState;
import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.data.Stat;
import java.time.Duration;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -82,7 +84,6 @@ public class TenantRepository {
private final ExecutorService bootstrapExecutor;
private final ScheduledExecutorService checkForRemovedApplicationsService = new ScheduledThreadPoolExecutor(1);
private final Optional<Curator.DirectoryCache> directoryCache;
- private final boolean throwExceptionIfBootstrappingFails;
/**
* Creates a new tenant repository
@@ -105,7 +106,6 @@ public class TenantRepository {
this.componentRegistry = componentRegistry;
ConfigserverConfig configserverConfig = componentRegistry.getConfigserverConfig();
this.bootstrapExecutor = Executors.newFixedThreadPool(configserverConfig.numParallelTenantLoaders());
- this.throwExceptionIfBootstrappingFails = configserverConfig.throwIfBootstrappingTenantRepoFails();
this.curator = componentRegistry.getCurator();
metricUpdater = componentRegistry.getMetrics().getOrCreateMetricUpdater(Collections.emptyMap());
this.tenantListeners.add(componentRegistry.getTenantListener());
@@ -148,7 +148,7 @@ public class TenantRepository {
public synchronized void addTenant(TenantName tenantName, RequestHandler requestHandler,
ReloadHandler reloadHandler) {
writeTenantPath(tenantName);
- createTenant(tenantName, requestHandler, reloadHandler);
+ createTenant(tenantName, componentRegistry.getClock().instant(), requestHandler, reloadHandler);
}
private static Set<TenantName> readTenantsFromZooKeeper(Curator curator) {
@@ -164,14 +164,14 @@ public class TenantRepository {
zkWatcherExecutor.execute(tenantName, () -> closeTenant(tenantName));
for (TenantName tenantName : allTenants)
if ( ! tenants.containsKey(tenantName))
- zkWatcherExecutor.execute(tenantName, () -> createTenant(tenantName));
+ zkWatcherExecutor.execute(tenantName, () -> bootstrapTenant(tenantName));
metricUpdater.setTenants(tenants.size());
}
private void bootstrapTenants() {
// Keep track of tenants created
Map<TenantName, Future<?>> futures = new HashMap<>();
- readTenantsFromZooKeeper(curator).forEach(t -> futures.put(t, bootstrapExecutor.submit(() -> createTenant(t))));
+ readTenantsFromZooKeeper(curator).forEach(t -> futures.put(t, bootstrapExecutor.submit(() -> bootstrapTenant(t))));
// Wait for all tenants to be created
Set<TenantName> failed = new HashSet<>();
@@ -187,7 +187,7 @@ public class TenantRepository {
}
}
- if (failed.size() > 0 && throwExceptionIfBootstrappingFails)
+ if (failed.size() > 0)
throw new RuntimeException("Could not create all tenants when bootstrapping, failed to create: " + failed);
metricUpdater.setTenants(tenants.size());
@@ -199,12 +199,21 @@ public class TenantRepository {
}
}
- protected void createTenant(TenantName tenantName) {
- createTenant(tenantName, null, null);
+ // Use when bootstrapping an existing tenant based on ZooKeeper data
+ protected void bootstrapTenant(TenantName tenantName) {
+ createTenant(tenantName, readCreatedTimeFromZooKeeper(tenantName), null, null);
+ }
+
+ public Instant readCreatedTimeFromZooKeeper(TenantName tenantName) {
+ Optional<Stat> stat = curator.getStat(getTenantPath(tenantName));
+ if (stat.isPresent())
+ return Instant.ofEpochMilli(stat.get().getCtime());
+ else
+ return componentRegistry.getClock().instant();
}
// Creates tenant and all its dependencies. This also includes loading active applications
- private void createTenant(TenantName tenantName, RequestHandler requestHandler, ReloadHandler reloadHandler) {
+ private void createTenant(TenantName tenantName, Instant created, RequestHandler requestHandler, ReloadHandler reloadHandler) {
if (tenants.containsKey(tenantName)) return;
TenantApplications applicationRepo =
@@ -225,9 +234,8 @@ public class TenantRepository {
applicationRepo, reloadHandler,
componentRegistry.getFlagSource(),
componentRegistry.getSessionPreparer());
- log.log(Level.INFO, "Creating tenant '" + tenantName + "'");
- Tenant tenant = new Tenant(tenantName, sessionRepository, requestHandler, applicationRepo,
- componentRegistry.getCurator());
+ log.log(Level.INFO, "Adding tenant '" + tenantName + "'" + ", created " + created);
+ Tenant tenant = new Tenant(tenantName, sessionRepository, requestHandler, applicationRepo, created);
notifyNewTenant(tenant);
tenants.putIfAbsent(tenantName, tenant);
}
@@ -303,7 +311,9 @@ public class TenantRepository {
throw new IllegalArgumentException("Deleting '" + name + "' failed, tenant does not exist");
log.log(Level.INFO, "Deleting tenant '" + name + "'");
- tenants.get(name).delete();
+ // Deletes the tenant tree from ZooKeeper (application and session status for the tenant)
+ // and triggers Tenant.close().
+ curator.delete(tenants.get(name).getPath());
}
private synchronized void closeTenant(TenantName name) {
@@ -316,11 +326,6 @@ public class TenantRepository {
tenant.close();
}
- // For unit testing
- String tenantZkPath(TenantName tenant) {
- return getTenantPath(tenant).getAbsolute();
- }
-
/**
* A helper to format a log preamble for messages with a tenant and app id
* @param app the app
@@ -446,4 +451,6 @@ public class TenantRepository {
return locksPath.append(tenantName.value());
}
+ public Curator getCurator() { return curator; }
+
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
index 8745a9bf596..c6d2c6b6438 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ApplicationRepositoryTest.java
@@ -63,7 +63,6 @@ import org.junit.rules.TemporaryFolder;
import java.io.File;
import java.io.IOException;
-import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
@@ -101,7 +100,7 @@ public class ApplicationRepositoryTest {
private final static TenantName tenant1 = TenantName.from("test1");
private final static TenantName tenant2 = TenantName.from("test2");
private final static TenantName tenant3 = TenantName.from("test3");
- private final static Clock clock = Clock.systemUTC();
+ private final static ManualClock clock = new ManualClock(Instant.now());
private ApplicationRepository applicationRepository;
private TenantRepository tenantRepository;
@@ -133,6 +132,7 @@ public class ApplicationRepositoryTest {
.fileReferencesDir(temporaryFolder.newFolder().getAbsolutePath())
.build())
.flagSource(flagSource)
+ .clock(clock)
.build();
tenantRepository = new TenantRepository(componentRegistry, false);
tenantRepository.addTenant(TenantRepository.HOSTED_VESPA_TENANT);
@@ -245,29 +245,6 @@ public class ApplicationRepositoryTest {
}
@Test
- public void deleteUnusedTenants() {
- // Set clock to epoch plus hour, as mock curator will always return epoch as creation time
- Instant now = ManualClock.at("1970-01-01T01:00:00");
-
- // 3 tenants exist, tenant1 and tenant2 has applications deployed:
- deployApp(testApp);
- deployApp(testApp, new PrepareParams.Builder().applicationId(applicationId(tenant2)).build());
-
- // Should not be deleted, not old enough
- Duration ttlForUnusedTenant = Duration.ofHours(1);
- assertTrue(applicationRepository.deleteUnusedTenants(ttlForUnusedTenant, now).isEmpty());
- // Should be deleted
- ttlForUnusedTenant = Duration.ofMillis(1);
- assertEquals(tenant3, applicationRepository.deleteUnusedTenants(ttlForUnusedTenant, now).iterator().next());
-
- // Delete app used by tenant1, tenant2 still has an application
- applicationRepository.delete(applicationId());
- Set<TenantName> tenantsDeleted = applicationRepository.deleteUnusedTenants(Duration.ofMillis(1), now);
- assertTrue(tenantsDeleted.contains(tenant1));
- assertFalse(tenantsDeleted.contains(tenant2));
- }
-
- @Test
public void deleteUnusedFileReferences() throws IOException {
File fileReferencesDir = temporaryFolder.newFolder();
@@ -372,7 +349,6 @@ public class ApplicationRepositoryTest {
@Test
public void testDeletingInactiveSessions() throws IOException {
- ManualClock clock = new ManualClock(Instant.now());
ConfigserverConfig configserverConfig =
new ConfigserverConfig(new ConfigserverConfig.Builder()
.configServerDBDir(temporaryFolder.newFolder("serverdb").getAbsolutePath())
@@ -455,7 +431,7 @@ public class ApplicationRepositoryTest {
var prepareParams = new PrepareParams.Builder().applicationId(applicationId)
.applicationRoles(ApplicationRoles.fromString("hostRole","containerRole")).build();
deployApp(testApp, prepareParams);
- var approlesStore = new ApplicationRolesStore(tenant.getCurator(), tenant.getPath());
+ var approlesStore = new ApplicationRolesStore(tenantRepository.getCurator(), tenant.getPath());
var appRoles = approlesStore.readApplicationRoles(applicationId);
// App roles present after deploy
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/MaintainerTester.java b/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/MaintainerTester.java
index c2489a1d3e9..4b37638cb50 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/MaintainerTester.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/MaintainerTester.java
@@ -10,15 +10,20 @@ import com.yahoo.vespa.config.server.tenant.TenantRepository;
import com.yahoo.vespa.curator.Curator;
import com.yahoo.vespa.curator.mock.MockCurator;
+import java.time.Clock;
+
class MaintainerTester {
private final Curator curator;
private final TenantRepository tenantRepository;
private final ApplicationRepository applicationRepository;
- MaintainerTester() {
+ MaintainerTester(Clock clock) {
curator = new MockCurator();
- GlobalComponentRegistry componentRegistry = new TestComponentRegistry.Builder().curator(curator).build();
+ GlobalComponentRegistry componentRegistry = new TestComponentRegistry.Builder()
+ .curator(curator)
+ .clock(clock)
+ .build();
tenantRepository = new TenantRepository(componentRegistry, false);
applicationRepository = new ApplicationRepository(tenantRepository,
new SessionHandlerTest.MockProvisioner(),
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/TenantsMaintainerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/TenantsMaintainerTest.java
index fdc6ffeacf0..53326a89293 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/TenantsMaintainerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/TenantsMaintainerTest.java
@@ -5,6 +5,7 @@ import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ApplicationName;
import com.yahoo.config.provision.InstanceName;
import com.yahoo.config.provision.TenantName;
+import com.yahoo.test.ManualClock;
import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.config.server.session.PrepareParams;
import com.yahoo.vespa.config.server.tenant.TenantRepository;
@@ -20,7 +21,8 @@ public class TenantsMaintainerTest {
@Test
public void deleteTenantWithNoApplications() {
- MaintainerTester tester = new MaintainerTester();
+ ManualClock clock = new ManualClock("2020-06-01T00:00:00");
+ MaintainerTester tester = new MaintainerTester(clock);
TenantRepository tenantRepository = tester.tenantRepository();
ApplicationRepository applicationRepository = tester.applicationRepository();
File applicationPackage = new File("src/test/apps/app");
@@ -36,7 +38,8 @@ public class TenantsMaintainerTest {
assertNotNull(tenantRepository.getTenant(shouldBeDeleted));
assertNotNull(tenantRepository.getTenant(shouldNotBeDeleted));
- new TenantsMaintainer(applicationRepository, tester.curator(), Duration.ofDays(1)).run();
+ clock.advance(TenantsMaintainer.defaultTtlForUnusedTenant.plus(Duration.ofDays(1)));
+ new TenantsMaintainer(applicationRepository, tester.curator(), Duration.ofDays(1), clock).run();
tenantRepository.updateTenants();
// One tenant should now have been deleted
@@ -59,4 +62,5 @@ public class TenantsMaintainerTest {
private ApplicationId applicationId(TenantName tenantName) {
return ApplicationId.from(tenantName, ApplicationName.from("foo"), InstanceName.defaultName());
}
+
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/tenant/TenantRepositoryTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/tenant/TenantRepositoryTest.java
index 104b94b274f..8d0285ac12b 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/tenant/TenantRepositoryTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/tenant/TenantRepositoryTest.java
@@ -170,15 +170,10 @@ public class TenantRepositoryTest {
public void testFailingBootstrap() throws IOException {
tenantRepository.close(); // stop using the one setup in Before method
- // No exception if config is false
- boolean throwIfBootstrappingTenantRepoFails = false;
- new FailingDuringBootstrapTenantRepository(createComponentRegistry(throwIfBootstrappingTenantRepoFails));
-
// Should get exception if config is true
- throwIfBootstrappingTenantRepoFails = true;
expectedException.expect(RuntimeException.class);
expectedException.expectMessage("Could not create all tenants when bootstrapping, failed to create: [default]");
- new FailingDuringBootstrapTenantRepository(createComponentRegistry(throwIfBootstrappingTenantRepoFails));
+ new FailingDuringBootstrapTenantRepository(createComponentRegistry());
}
private List<String> readZKChildren(String path) throws Exception {
@@ -186,16 +181,16 @@ public class TenantRepositoryTest {
}
private void assertZooKeeperTenantPathExists(TenantName tenantName) throws Exception {
- assertNotNull(globalComponentRegistry.getCurator().framework().checkExists().forPath(tenantRepository.tenantZkPath(tenantName)));
+ assertNotNull(globalComponentRegistry.getCurator().framework()
+ .checkExists().forPath(TenantRepository.getTenantPath(tenantName).getAbsolute()));
}
- private GlobalComponentRegistry createComponentRegistry(boolean throwIfBootstrappingTenantRepoFails) throws IOException {
+ private GlobalComponentRegistry createComponentRegistry() throws IOException {
return new TestComponentRegistry.Builder()
.curator(new MockCurator())
.configServerConfig(new ConfigserverConfig(new ConfigserverConfig.Builder()
- .throwIfBootstrappingTenantRepoFails(throwIfBootstrappingTenantRepoFails)
- .configDefinitionsDir(temporaryFolder.newFolder("configdefs" + throwIfBootstrappingTenantRepoFails).getAbsolutePath())
- .configServerDBDir(temporaryFolder.newFolder("configserverdb" + throwIfBootstrappingTenantRepoFails).getAbsolutePath())))
+ .configDefinitionsDir(temporaryFolder.newFolder("configdefs").getAbsolutePath())
+ .configServerDBDir(temporaryFolder.newFolder("configserverdb").getAbsolutePath())))
.zone(new Zone(SystemName.cd, Environment.prod, RegionName.from("foo")))
.build();
}
@@ -207,7 +202,7 @@ public class TenantRepositoryTest {
}
@Override
- public void createTenant(TenantName tenantName) {
+ public void bootstrapTenant(TenantName tenantName) {
throw new RuntimeException("Failed to create: " + tenantName);
}
}