@Test
    public void testPendingRestartsAreTriggered() {
        List<Host> hosts = createHosts(9, "6.1.0", "6.2.0");
        List<ServiceInfo> services = createServices(1);

        List<ModelFactory> modelFactories = List.of(
                new ConfigChangeActionsModelFactory(Version.fromString("6.2.0"),
                        new VespaRestartAction(ClusterSpec.Id.from("test"), "change", services)));

        List<ServiceInfo> mutableServices = new ArrayList<>(services);
        DeployTester tester = createTester(hosts,
                                           modelFactories,
                                           prodZone,
                                           Clock.systemUTC(),
                                           new MockConfigConvergenceChecker(2L, mutableServices));
        var result = tester.deployApp("src/test/apps/hosted/", "6.2.0");
        DeployHandlerLogger deployLogger = result.deployLogger();

        assertLogContainsMessage(deployLogger, "Scheduled service restart of 1 nodes: hostName0");
        assertEquals(Set.of(), tester.applicationRepository().getPendingRestarts(tester.applicationId()).restartsReadyAt(1));
        assertEquals(Set.of("hostName0"), tester.applicationRepository().getPendingRestarts(tester.applicationId()).hostnames());

        PendingRestartsMaintainer maintainer = new PendingRestartsMaintainer(tester.applicationRepository(),
                                                                             tester.curator(),
                                                                             tester.applicationRepository().clock(),
                                                                             Duration.ofDays(1));
        // Maintainer does not trigger services before convergence has been reached
        maintainer.run();
        assertEquals(Set.of(), tester.applicationRepository().getPendingRestarts(tester.applicationId()).restartsReadyAt(1));
        assertEquals(Set.of("hostName0"), tester.applicationRepository().getPendingRestarts(tester.applicationId()).hostnames());

        // All services converge, and maintainer triggers restarts
        mutableServices.clear();
        maintainer.run();
        assertEquals(Set.of(), tester.applicationRepository().getPendingRestarts(tester.applicationId()).hostnames());
    }
Test that deploying an application works when there are no allocated hosts in the system
(the bootstrap a new zone case, so deploying the routing app since that is the first deployment
that will be done)
configserver/src/test/java/com/yahoo/vespa/config/server/deploy/HostedDeployTest.java