@Test
    public void nodes_with_busy_snapshotting_are_not_failed() {
        NodeFailTester tester = NodeFailTester.withTwoApplications();
        Node downNode = tester.nodeRepository.nodes().list(Node.State.active).owner(NodeFailTester.app2).stateful().asList().get(0);
        String downNodeHostname = downNode.hostname();
        Node downHost = tester.nodeRepository.nodes().list().owner(NodeFailTester.app1).asList().get(0);
        String downHostHostname = downHost.hostname();

        // Set host as parent of node. Set both as down
        tester.tester.move(Node.State.active, List.of(downHost));
        tester.nodeRepository.nodes().write(downNode.withParentHostname(downHost.hostname()), () -> {});
        tester.nodeRepository.nodes().write(downHost.with(NodeType.host), () -> {});
        tester.nodeRepository.orchestrator().setNodeStatus(new HostName(downHostHostname), HostStatus.ALLOWED_TO_BE_DOWN);
        tester.nodeRepository.orchestrator().setNodeStatus(new HostName(downNodeHostname), HostStatus.ALLOWED_TO_BE_DOWN);
        tester.serviceMonitor.setHostDown(downHostHostname);
        tester.serviceMonitor.setHostDown(downNodeHostname);
        tester.runMaintainers();

        // Child busy snapshotting -> neither will fail
        tester.nodeRepository.snapshots().create(downNodeHostname, tester.clock.instant());
        tester.clock.advance(Duration.ofMinutes(270));
        tester.runMaintainers();
        assertEquals(Node.State.active, tester.nodeRepository.nodes().node(downHostHostname).get().state());
        assertEquals(Node.State.active, tester.nodeRepository.nodes().node(downNodeHostname).get().state());

        // No busy snapshots -> will fail
        Snapshot snapshot = tester.nodeRepository.snapshots().read(downNodeHostname).get(0);
        tester.nodeRepository.snapshots().remove(snapshot.id(), downNodeHostname, true);
        tester.runMaintainers();
        assertEquals(Node.State.failed, tester.nodeRepository.nodes().node(downNodeHostname).get().state());
        tester.runMaintainers();
        assertEquals(Node.State.failed, tester.nodeRepository.nodes().node(downHostHostname).get().state());
    }
Tests automatic failing of nodes.

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