@Test
    public void nodes_undergoing_cmr_are_not_failed() {
        var tester = NodeFailTester.withTwoApplications(6);
        var clock = tester.clock;
        var slime = SlimeUtils.jsonToSlime(
                String.format("""
                        {
                            "upcoming":[{
                                "id": "id-42",
                                "status": "some-status",
                                "plannedStartTime": %d,
                                "plannedEndTime": %d
                            }]
                        }
                """, clock.instant().getEpochSecond(), clock.instant().plus(Duration.ofMinutes(90)).getEpochSecond())
        );
        var cmrReport = Report.fromSlime("vcmr", slime.get());
        var downHost = tester.nodeRepository.nodes().list(Node.State.active).owner(NodeFailTester.app1).asList().get(1).hostname();

        var node = tester.nodeRepository.nodes().node(downHost).get();
        tester.nodeRepository.nodes().write(node.with(node.reports().withReport(cmrReport)), () -> {});

        tester.serviceMonitor.setHostDown(downHost);
        tester.runMaintainers();
        node = tester.nodeRepository.nodes().node(downHost).get();
        assertTrue(node.history().isDown());
        assertEquals(Node.State.active, node.state());

        // CMR still ongoing, don't fail yet
        clock.advance(Duration.ofHours(1));
        tester.runMaintainers();
        node = tester.nodeRepository.nodes().node(downHost).get();
        assertTrue(node.history().isDown());
        assertEquals(Node.State.active, node.state());

        // No ongoing CMR anymore, host should be failed
        clock.advance(Duration.ofHours(1));
        tester.runMaintainers();
        node = tester.nodeRepository.nodes().node(downHost).get();
        assertTrue(node.history().isDown());
        assertEquals(Node.State.failed, node.state());
    }
Tests automatic failing of nodes.

@author bratseth
@author mpolden
node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailerTest.java