@Test
    public void partial_in_place_resource_increase() {
        addParentHosts(4, new NodeResources(8, 16, 320, 8, fast, local));

        // Allocate 2 nodes for one app that leaves exactly enough capacity for mediumResources left on the host
        new PrepareHelper(tester, ProvisioningTester.applicationId()).prepare(container1, 2, 1, mediumResources).activate();

        // Allocate 4 nodes for another app. After this, 2 hosts should be completely full
        new PrepareHelper(tester, app).prepare(container1, 4, 1, mediumResources).activate();

        // Attempt to increase resources of the other app
        try {
            new PrepareHelper(tester, app).prepare(container1, 4, 1, largeResources);
            fail("Expected to fail node allocation");
        } catch (NodeAllocationException ignored) { }

        // Add 2 more parent host, now we should be able to do the same deployment that failed earlier
        // 2 of the nodes will be increased in-place and 2 will be allocated to the new hosts.
        addParentHosts(2, new NodeResources(8, 16, 320, 8, fast, local));

        Set<String> initialHostnames = new HashSet<>(listCluster(container1).hostnames());
        new PrepareHelper(tester, app).prepare(container1, 4, 1, largeResources).activate();
        NodeList appNodes = tester.getNodes(app, Node.State.active);
        assertEquals(6, appNodes.size()); // 4 nodes with large resources + 2 retired nodes with medium resources
        appNodes.forEach(node -> {
            if (node.allocation().get().membership().retired())
                assertEquals(new NodeResources(4, 8, 160, 1, fast, local), node.resources());
            else
                assertEquals(new NodeResources(8, 16, 320, 1, fast, local), node.resources());
            initialHostnames.remove(node.hostname());
        });
        assertTrue("All initial nodes should still be allocated to the application", initialHostnames.isEmpty());
    }
Node resources can be increased in-place if
 1. No change to topology
 2. No reduction to cluster size
 3. There is enough spare capacity on host

Node resources can be decreased in-place if
 1. No change to topology
 2. No reduction to cluster size
 3. For content/combined nodes: No increase to cluster size

Node resources are increased if at least one of the components (vcpu, memory, disk, bandwidth) is increased.

@author freva
node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/InPlaceResizeProvisionTest.java