@Test
    public void allocation_balancing() {
        // Here we test balancing between cpu and memory and ignore disk

        ProvisioningTester tester = new ProvisioningTester.Builder().zone(new Zone(Environment.prod, RegionName.from("us-east"))).flavorsConfig(flavorsConfig()).build();
        tester.makeReadyNodes(3, "flt", NodeType.host, 8); // cpu: 30, mem: 30
        tester.makeReadyNodes(3, "cpu", NodeType.host, 8); // cpu: 40, mem: 20
        tester.makeReadyNodes(3, "mem", NodeType.host, 8); // cpu: 20, mem: 40
        tester.activateTenantHosts();
        NodeResources fltResources = new NodeResources(6, 6, 10, 0.1);
        NodeResources cpuResources = new NodeResources(8, 4, 10, 0.1);
        NodeResources memResources = new NodeResources(4, 8, 10, 0.1);

        // Cpu heavy application
        ApplicationId application1 = makeApplicationId("t1", "a1");
        deployApp(application1, clusterSpec("c"), cpuResources, tester, 2);
        tester.assertAllocatedOn("Cpu nodes cause least skew increase", "cpu", application1);

        // Mem heavy application
        ApplicationId application2 = makeApplicationId("t2", "a2");
        deployApp(application2, clusterSpec("c"), memResources, tester, 2);
        tester.assertAllocatedOn("Mem nodes cause least skew increase", "mem", application2);

        // Flat application
        ApplicationId application3 = makeApplicationId("t3", "a3");
        deployApp(application3, clusterSpec("c"), fltResources, tester, 2);
        tester.assertAllocatedOn("Flat nodes cause least skew increase", "flt", application3);

        // Mem heavy application which can't all be allocated on mem nodes
        ApplicationId application4 = makeApplicationId("t4", "a4");
        deployApp(application4, clusterSpec("c"), memResources, tester, 3);
        assertEquals(2, tester.hostFlavorCount("mem", application4));
        assertEquals(1, tester.hostFlavorCount("flt", application4));

    }
Test an allocation workflow:
<p>
5 Hosts of capacity 3 (2 spares)
- Allocate app with 3 nodes
- Allocate app with 2 nodes
- Fail host and check redistribution
node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicAllocationTest.java