diff options
author | Valerij Fredriksen <valerijf@yahooinc.com> | 2023-07-03 15:50:58 +0200 |
---|---|---|
committer | Valerij Fredriksen <valerijf@yahooinc.com> | 2023-07-03 15:50:58 +0200 |
commit | f91ff91230f9004561e1d705010ab2f15bf8d47d (patch) | |
tree | 2d78a4f3efda3ac04da9c3129ec0ab5837d890a8 /node-repository/src/test | |
parent | 78f20e140db88e1b3ad26ffc3419e408716f4e57 (diff) |
Avoid allocating non-exclusive children to exclusive hosts of different application
Diffstat (limited to 'node-repository/src/test')
-rw-r--r-- | node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicProvisioningTest.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicProvisioningTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicProvisioningTest.java index 7dbed807480..e1e83ad2fb3 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicProvisioningTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicProvisioningTest.java @@ -214,7 +214,8 @@ public class DynamicProvisioningTest { @Test public void retires_on_exclusivity_violation() { - var tester = tester(true); + var tester = tester(false); + tester.flagSource().withJacksonFlag(PermanentFlags.SHARED_HOST.id(), new SharedHost(List.of(new HostResources(1., 1., 1., 1., "fast", "local", null, 10, "x86_64"))), SharedHost.class); ApplicationId application1 = ProvisioningTester.applicationId(); NodeResources resources = new NodeResources(4, 80, 100, 1); prepareAndActivate(application1, clusterSpec("mycluster"), 4, 1, resources, tester); @@ -229,8 +230,20 @@ public class DynamicProvisioningTest { // Redeploy without exclusive again is no-op prepareAndActivate(application1, clusterSpec("mycluster"), 4, 1, smallerExclusiveResources, tester); - assertEquals(8, tester.nodeRepository().nodes().list().owner(application1).size()); - assertEquals(initialNodes, tester.nodeRepository().nodes().list().owner(application1).retired()); + NodeList nodes = tester.nodeRepository().nodes().list(); + assertEquals(8, nodes.owner(application1).size()); + assertEquals(initialNodes, nodes.owner(application1).retired()); + + // Remove the old retired nodes and make 2 random parents of current nodes violate exclusivity + tester.patchNodes(initialNodes.asList(), node -> node.removable(true)); + NodeList exclusiveViolators = nodes.owner(application1).not().retired().first(2); + List<Node> parents = exclusiveViolators.mapToList(node -> nodes.parentOf(node).get()); + tester.patchNode(parents.get(0), node -> node.withExclusiveToApplicationId(ApplicationId.defaultId())); + tester.patchNode(parents.get(1), node -> node.withExclusiveToClusterType(ClusterSpec.Type.container)); + + prepareAndActivate(application1, clusterSpec("mycluster"), 4, 1, smallerExclusiveResources, tester); + assertEquals(10, tester.nodeRepository().nodes().list().owner(application1).size()); + assertEquals(exclusiveViolators, tester.nodeRepository().nodes().list().owner(application1).retired()); } @Test |