@Test
    public void fail_readying_with_hard_fail() {
        NodeRepositoryTester tester = new NodeRepositoryTester();
        tester.addHost("host1", "host1", "default", NodeType.host);
        tester.addHost("host2", "host2", "default", NodeType.host);

        Node node2 = tester.nodeRepository().nodes().node("host2").orElseThrow();
        var reportsBuilder = new Reports.Builder(node2.reports());
        reportsBuilder.setReport(Report.basicReport("reportId", Report.Type.HARD_FAIL, Instant.EPOCH, "hardware failure"));
        node2 = node2.with(reportsBuilder.build());
        tester.nodeRepository().nodes().write(node2, () -> {});

        tester.nodeRepository().nodes().markNodeAvailableForNewAllocation("host1", Agent.system, getClass().getSimpleName());
        assertEquals(Node.State.ready, tester.nodeRepository().nodes().node("host1").get().state());

        try {
            tester.nodeRepository().nodes().markNodeAvailableForNewAllocation("host2", Agent.system, getClass().getSimpleName());
            fail();
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage().contains("hardware failure"));
        }
    }
tests basic operation of the node repository

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