@Test
    public void will_retire_clashing_active() {
        ProvisioningTester tester = new ProvisioningTester.Builder().build();

        tester.makeReadyHosts(4, resources1).activateTenantHosts();
        int containerNodeCount = 2;
        int contentNodeCount = 2;
        int groups = 1;
        List<HostSpec> containerNodes = tester.prepare(applicationId, containerClusterSpec, containerNodeCount, groups, resources1);
        List<HostSpec> contentNodes = tester.prepare(applicationId, contentClusterSpec, contentNodeCount, groups, resources1);
        tester.activate(applicationId, concat(containerNodes, contentNodes));

        NodeList nodes = tester.getNodes(applicationId, Node.State.active);
        assertEquals(4, nodes.size());
        assertDistinctParentHosts(nodes, ClusterSpec.Type.container, containerNodeCount);
        assertDistinctParentHosts(nodes, ClusterSpec.Type.content, contentNodeCount);

        tester.patchNodes(nodes.asList(), (n) -> n.withParentHostname("clashing"));
        containerNodes = tester.prepare(applicationId, containerClusterSpec, containerNodeCount, groups, resources1);
        contentNodes = tester.prepare(applicationId, contentClusterSpec, contentNodeCount, groups, resources1);
        tester.activate(applicationId, concat(containerNodes, contentNodes));

        nodes = tester.getNodes(applicationId, Node.State.active);
        assertEquals(6, nodes.size());
        assertEquals(2, nodes.stream().filter(n -> n.allocation().get().membership().retired()).count());
    }
Tests provisioning of virtual nodes

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