@Test
    public void testBootstrap() throws Exception {
        ConfigserverConfig configserverConfig = createConfigserverConfig(temporaryFolder);
        InMemoryProvisioner provisioner = new InMemoryProvisioner(9, false);
        DeployTester tester = new DeployTester.Builder(temporaryFolder).modelFactory(createHostedModelFactory())
                                                                       .configserverConfig(configserverConfig)
                                                                       .hostProvisioner(provisioner).build();
        tester.deployApp("src/test/apps/hosted/");

        RpcServer rpcServer = createRpcServer(configserverConfig);
        // Take a host away so that there are too few for the application, to verify we can still bootstrap
        provisioner.allocations().values().iterator().next().remove(0);
        Bootstrapper bootstrap = createBootstrapper(tester, rpcServer, VIP_STATUS_PROGRAMMATICALLY);
        assertTrue(bootstrap.isUpgraded());
        assertEquals(List.of("ApplicationPackageMaintainer", "TenantsMaintainer"),
                     bootstrap.configServerMaintenance().maintainers().stream()
                              .map(Maintainer::name)
                              .sorted().toList());
        assertFalse(bootstrap.vipStatus().isInRotation());

        bootstrap.doStart();
        waitUntil(rpcServer::isRunning, "failed waiting for Rpc server running");
        assertTrue(rpcServer.isServingConfigRequests());
        waitUntil(() -> bootstrap.status() == StateMonitor.Status.up, "failed waiting for status 'up'");
        waitUntil(() -> bootstrap.vipStatus().isInRotation(), "failed waiting for server to be in rotation");
        assertEquals(List.of("ApplicationPackageMaintainer", "FileDistributionMaintainer", "PendingRestartsMaintainer", "ReindexingMaintainer", "SessionsMaintainer", "TenantsMaintainer"),
                     bootstrap.configServerMaintenance().maintainers().stream()
                              .map(Maintainer::name)
                              .sorted().toList());

        bootstrap.deconstruct();
        assertEquals(StateMonitor.Status.down, bootstrap.status());
        assertFalse(rpcServer.isRunning());
        assertTrue(rpcServer.isServingConfigRequests());
        assertFalse(bootstrap.vipStatus().isInRotation());
    }
@author Ulf Lilleengen
@author Harald Musum
configserver/src/test/java/com/yahoo/vespa/config/server/ConfigServerBootstrapTest.java