@Test
    public void breakfix_tenant_host() {
        NodeRepositoryTester tester = new NodeRepositoryTester();
        tester.addHost("host1", "host1", "default", NodeType.host);
        tester.addNode("node1", "node1", "host1", "docker", NodeType.tenant);
        String reason = NodeRepositoryTest.class.getSimpleName();

        try {
            tester.nodeRepository().nodes().breakfixRecursively("node1", Agent.system, reason);
            fail("Should not be able to breakfix tenant node");
        } catch (IllegalArgumentException ignored) {}

        try {
            tester.nodeRepository().nodes().breakfixRecursively("host1", Agent.system, reason);
            fail("Should not be able to breakfix host in state not in [parked, failed]");
        } catch (IllegalArgumentException ignored) {}

        tester.setNodeState("host1", Node.State.failed);
        tester.setNodeState("node1", Node.State.active);
        try {
            tester.nodeRepository().nodes().breakfixRecursively("host1", Agent.system, reason);
            fail("Should not be able to breakfix host with active tenant node");
        } catch (IllegalArgumentException ignored) {}

        tester.setNodeState("node1", Node.State.failed);
        tester.nodeRepository().nodes().breakfixRecursively("host1", Agent.system, reason);

        assertEquals(1, tester.nodeRepository().nodes().list().size());
        Node node = tester.nodeRepository().nodes().list().first().get();
        assertEquals("host1", node.hostname());
        assertEquals(Node.State.breakfixed, node.state());
    }
tests basic operation of the node repository

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