@Test
    public void does_not_allocate_to_suspended_hosts() {
        ProvisioningTester tester = new ProvisioningTester.Builder().zone(new Zone(Environment.prod, RegionName.from("us-east"))).flavorsConfig(flavorsConfig()).build();
        tester.makeReadyNodes(4, "host-small", NodeType.host, 32);
        tester.activateTenantHosts();

        HostName randomHost = new HostName(tester.nodeRepository().nodes().list(State.active).first().get().hostname());
        tester.orchestrator().suspend(randomHost);

        ApplicationId application1 = ProvisioningTester.applicationId();
        ClusterSpec clusterSpec = clusterSpec("myContent.t1.a1");
        NodeResources flavor = new NodeResources(1, 4, 100, 1);

        try {
            tester.prepare(application1, clusterSpec, 4, 1, flavor);
            fail("Should not be able to deploy 4 nodes on 4 hosts because 1 is suspended");
        } catch (NodeAllocationException ignored) { }

        // Resume the host, the deployment goes through
        tester.orchestrator().resume(randomHost);
        tester.activate(application1, tester.prepare(application1, clusterSpec, 4, 1, flavor));
        Set<String> hostnames = tester.getNodes(application1, State.active).hostnames();

        // Verify that previously allocated nodes are not affected by host suspension
        tester.orchestrator().suspend(randomHost);
        tester.activate(application1, tester.prepare(application1, clusterSpec, 4, 1, flavor));
        assertEquals(hostnames, tester.getNodes(application1, State.active).hostnames());
    }
Test redeployment of nodes that violates spare headroom - but without alternatives
<p>
Setup 2 hosts and allocate one app with a container on each. 2 spares
<p>
Initial allocation of app 1 --> final allocation:
<p>
|    |    |        |    |    |
|    |    |   -->  |    |    |
| 1a | 1b |        | 1a | 1b |
node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicAllocationTest.java