@Test
    public void respects_exclusive_to_cluster_type() {
        NodeResources resources = new NodeResources(10, 10, 100, 10);
        ProvisioningTester tester = new ProvisioningTester.Builder().zone(new Zone(Environment.prod, RegionName.from("us-east"))).build();

        tester.makeReadyNodes(10, resources, Optional.empty(), NodeType.host, 1);
        tester.activateTenantHosts();
        // All hosts are exclusive to content nodes
        tester.patchNodes(tester.nodeRepository().nodes().list().asList(), node -> node.withExclusiveToClusterType(ClusterSpec.Type.content));

        Version wantedVespaVersion = Version.fromString("6.39");
        try {
            // No capacity for 'container' nodes
            tester.prepare(applicationId,
                    ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from("my-content")).vespaVersion(wantedVespaVersion).build(),
                    6, 1, resources);
            fail("Expected to fail node allocation");
        } catch (NodeAllocationException ignored) { }

        // Same cluster, but content type is now 'content'
        List<HostSpec> nodes = tester.prepare(applicationId,
                ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("my-content")).vespaVersion(wantedVespaVersion).build(),
                6, 1, resources);
        tester.activate(applicationId, nodes);

        assertEquals(6, tester.nodeRepository().nodes().list(Node.State.active).owner(applicationId).size());
    }
Tests provisioning of virtual nodes

@author hmusum
@author mpolden
node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/VirtualNodeProvisioningTest.java