@Override
    protected double maintain() {
        // Reboot candidates: Nodes in long-term states, where we know we can safely orchestrate a reboot
        List<Node> nodesToReboot = nodeRepository().nodes().list(Node.State.active, Node.State.ready).stream()
                .filter(node -> node.type().isHost())
                .filter(this::shouldReboot)
                .toList();

        if (!nodesToReboot.isEmpty())
            nodeRepository().nodes().reboot(NodeListFilter.from(nodesToReboot));
        return 1.0;
    }
@Test
    public void testRebootScheduling() {
        Duration rebootInterval = Duration.ofDays(30);
        InMemoryFlagSource flagSource = new InMemoryFlagSource();
        ProvisioningTester tester = createTester(rebootInterval, flagSource);

        makeReadyHosts(15, tester);
        NodeRepository nodeRepository = tester.nodeRepository();
        NodeRebooter rebooter = new NodeRebooter(nodeRepository, flagSource, new TestMetric());

        assertReadyHosts(15, nodeRepository, 0L);

        // No reboots within 0x-1x reboot interval
        tester.clock().advance(rebootInterval);
        rebooter.maintain();
        simulateReboot(nodeRepository);
        assertReadyHosts(15, nodeRepository, 0L);

        // All nodes/hosts reboots within 1x-2x reboot interval
        tester.clock().advance(rebootInterval);
        rebooter.maintain();
        simulateReboot(nodeRepository);
        assertReadyHosts(15, nodeRepository, 1L);

        // OS upgrade just before reboots would have been scheduled again
        tester.clock().advance(rebootInterval);
        scheduleOsUpgrade(nodeRepository);
        simulateOsUpgrade(nodeRepository);
        rebooter.maintain();
        simulateReboot(nodeRepository);
        assertReadyHosts(15, nodeRepository, 1L);

        // OS upgrade counts as reboot, so within 0x-1x there is no reboots
        tester.clock().advance(rebootInterval);
        rebooter.maintain();
        scheduleOsUpgrade(nodeRepository);
        simulateOsUpgrade(nodeRepository);
        assertReadyHosts(15, nodeRepository, 1L);

        // OS upgrade counts as reboot, but within 1x-2x reboots are scheduled again
        tester.clock().advance(rebootInterval);
        rebooter.maintain();
        simulateReboot(nodeRepository);
        assertReadyHosts(15, nodeRepository, 2L);
    }