diff options
Diffstat (limited to 'node-repository')
7 files changed, 66 insertions, 56 deletions
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailTester.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailTester.java index d44b8ca2989..11d3fc23e0f 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailTester.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/NodeFailTester.java @@ -115,7 +115,7 @@ public class NodeFailTester { List<Node> hosts = tester.createHostNodes(numberOfHosts); for (int i = 0; i < hosts.size(); i++) { tester.createReadyNodes(nodesPerHost, i * nodesPerHost, Optional.of("parent" + i), - nodeFlavors.getFlavorOrThrow("d-1-1-1"), NodeType.tenant); + new NodeResources(1, 1, 1, 0.3), NodeType.tenant); } // Create applications @@ -232,8 +232,8 @@ public class NodeFailTester { return createReadyNodes(count, startIndex, Optional.empty(), new Flavor(resources), NodeType.tenant); } - public List<Node> createReadyNodes(int count, int startIndex, Flavor flavor) { - return createReadyNodes(count, startIndex, Optional.empty(), flavor, NodeType.tenant); + private List<Node> createReadyNodes(int count, int startIndex, Optional<String> parentHostname, NodeResources resources, NodeType nodeType) { + return createReadyNodes(count, startIndex, parentHostname, new Flavor(resources), nodeType); } private List<Node> createReadyNodes(int count, int startIndex, Optional<String> parentHostname, Flavor flavor, NodeType nodeType) { diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/AclProvisioningTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/AclProvisioningTest.java index 762fd87c2d1..50fb8290bd5 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/AclProvisioningTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/AclProvisioningTest.java @@ -37,16 +37,17 @@ public class AclProvisioningTest { List<Node> configServers = tester.makeConfigServers(3, "d-1-1-1", Version.fromString("6.123.456")); // Populate repo - tester.makeReadyNodes(10, "d-1-1-1"); - List<Node> dockerHost = tester.makeReadyNodes(1, "d-1-1-1", NodeType.host); + tester.makeReadyNodes(10, new NodeResources(1, 1, 1, 1)); + List<Node> dockerHost = tester.makeReadyNodes(1, new NodeResources(1, 1, 1, 1), NodeType.host); ApplicationId zoneApplication = tester.makeApplicationId(); deploy(zoneApplication, Capacity.fromRequiredNodeType(NodeType.host)); - tester.makeReadyVirtualDockerNodes(1, NodeResources.fromLegacyName("d-1-1-1"), dockerHost.get(0).hostname()); - List<Node> proxyNodes = tester.makeReadyNodes(3, "d-1-1-1", NodeType.proxy); + tester.makeReadyVirtualDockerNodes(1,new NodeResources(1, 1, 1, 1), + dockerHost.get(0).hostname()); + List<Node> proxyNodes = tester.makeReadyNodes(3, new NodeResources(1, 1, 1, 1), NodeType.proxy); // Allocate 2 nodes ApplicationId application = tester.makeApplicationId(); - List<Node> activeNodes = deploy(application, Capacity.fromCount(2, NodeResources.fromLegacyName("d-1-1-1"), false, true)); + List<Node> activeNodes = deploy(application, Capacity.fromCount(2, new NodeResources(1, 1, 1, 1), false, true)); assertEquals(2, activeNodes.size()); // Get trusted nodes for the first active node diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicDockerAllocationTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicDockerAllocationTest.java index efff5333fae..1e25e861cbe 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicDockerAllocationTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/DynamicDockerAllocationTest.java @@ -358,6 +358,7 @@ public class DynamicDockerAllocationTest { NodeResources.DiskSpeed.slow, hosts.get(0).flavor().get().resources().diskSpeed()); } + @SuppressWarnings("deprecation") @Test public void testSwitchingFromLegacyFlavorSyntaxToResourcesDoesNotCauseReallocation() { ProvisioningTester tester = new ProvisioningTester.Builder().zone(new Zone(Environment.prod, RegionName.from("us-east"))).flavorsConfig(flavorsConfig()).build(); diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/LoadBalancerProvisionerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/LoadBalancerProvisionerTest.java index 08112f9b055..9aa1cc4bd47 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/LoadBalancerProvisionerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/LoadBalancerProvisionerTest.java @@ -54,8 +54,8 @@ public class LoadBalancerProvisionerTest { // Provision a load balancer for each application var nodes = prepare(app1, - clusterRequest(ClusterSpec.Type.container, containerCluster1), - clusterRequest(ClusterSpec.Type.content, contentCluster)); + clusterRequest(ClusterSpec.Type.container, containerCluster1), + clusterRequest(ClusterSpec.Type.content, contentCluster)); assertEquals(1, lbApp1.get().size()); assertEquals("Prepare provisions load balancer with reserved nodes", 2, lbApp1.get().get(0).instance().reals().size()); tester.activate(app1, nodes); @@ -212,7 +212,7 @@ public class LoadBalancerProvisionerTest { if (dynamicDockerNodes) { makeDynamicDockerNodes(specs.length * 2, capacity.type()); } else { - tester.makeReadyNodes(specs.length * 2, "d-1-1-1", capacity.type()); + tester.makeReadyNodes(specs.length * 2, new NodeResources(1, 1, 1, 0.3), capacity.type()); } Set<HostSpec> allNodes = new LinkedHashSet<>(); for (ClusterSpec spec : specs) { @@ -225,7 +225,8 @@ public class LoadBalancerProvisionerTest { List<Node> nodes = new ArrayList<>(n); for (int i = 1; i <= n; i++) { var node = Node.createDockerNode(Set.of(), "node" + i, "parent" + i, - NodeResources.fromLegacyName("d-1-1-1"), nodeType); + new NodeResources(1, 1, 1, 0.3), + nodeType); nodes.add(node); } nodes = tester.nodeRepository().database().addNodesInState(nodes, Node.State.reserved); diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/MultigroupProvisioningTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/MultigroupProvisioningTest.java index a10f0bc5f23..1836589c0ab 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/MultigroupProvisioningTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/MultigroupProvisioningTest.java @@ -33,31 +33,34 @@ import static org.junit.Assert.assertTrue; */ public class MultigroupProvisioningTest { + private static final NodeResources small = new NodeResources(1, 1, 1, 1); + private static final NodeResources large = new NodeResources(3, 3, 3, 3); + @Test public void test_provisioning_of_multiple_groups() { ProvisioningTester tester = new ProvisioningTester.Builder().zone(new Zone(Environment.prod, RegionName.from("us-east"))).build(); ApplicationId application1 = tester.makeApplicationId(); - tester.makeReadyNodes(21, "d-1-3-9"); - - deploy(application1, 6, 1, "d-1-3-9", tester); - deploy(application1, 6, 2, "d-1-3-9", tester); - deploy(application1, 6, 3, "d-1-3-9", tester); - deploy(application1, 6, 6, "d-1-3-9", tester); - deploy(application1, 6, 1, "d-1-3-9", tester); - deploy(application1, 6, 6, "d-1-3-9", tester); - deploy(application1, 6, 6, "d-1-3-9", tester); - deploy(application1, 6, 2, "d-1-3-9", tester); - deploy(application1, 8, 2, "d-1-3-9", tester); - deploy(application1, 9, 3, "d-1-3-9", tester); - deploy(application1, 9, 3, "d-1-3-9", tester); - deploy(application1, 9, 3, "d-1-3-9", tester); - deploy(application1,12, 4, "d-1-3-9", tester); - deploy(application1, 8, 4, "d-1-3-9", tester); - deploy(application1,12, 4, "d-1-3-9", tester); - deploy(application1, 8, 2, "d-1-3-9", tester); - deploy(application1, 6, 3, "d-1-3-9", tester); + tester.makeReadyNodes(21, small); + + deploy(application1, 6, 1, small, tester); + deploy(application1, 6, 2, small, tester); + deploy(application1, 6, 3, small, tester); + deploy(application1, 6, 6, small, tester); + deploy(application1, 6, 1, small, tester); + deploy(application1, 6, 6, small, tester); + deploy(application1, 6, 6, small, tester); + deploy(application1, 6, 2, small, tester); + deploy(application1, 8, 2, small, tester); + deploy(application1, 9, 3, small, tester); + deploy(application1, 9, 3, small, tester); + deploy(application1, 9, 3, small, tester); + deploy(application1,12, 4, small, tester); + deploy(application1, 8, 4, small, tester); + deploy(application1,12, 4, small, tester); + deploy(application1, 8, 2, small, tester); + deploy(application1, 6, 3, small, tester); } /** @@ -65,13 +68,14 @@ public class MultigroupProvisioningTest { * due to asymmetric group sizes after step 2 (second group has 3 additional retired nodes). * We probably need to switch to a multipass group allocation procedure to fix this case. */ - @Test @Ignore + @Ignore + @Test public void test_provisioning_of_groups_with_asymmetry() { ProvisioningTester tester = new ProvisioningTester.Builder().zone(new Zone(Environment.prod, RegionName.from("us-east"))).build(); ApplicationId application1 = tester.makeApplicationId(); - tester.makeReadyNodes(21, "d-1-3-9"); + tester.makeReadyNodes(21, large); deploy(application1, 12, 2, tester); deploy(application1, 9, 3, tester); @@ -84,12 +88,12 @@ public class MultigroupProvisioningTest { ApplicationId application1 = tester.makeApplicationId(); - tester.makeReadyNodes(10, "d-1-1-1"); - tester.makeReadyNodes(10, "d-3-3-3"); + tester.makeReadyNodes(10, small); + tester.makeReadyNodes(10, large); - deploy(application1, 8, 1, "d-1-1-1", tester); - deploy(application1, 8, 1, "d-3-3-3", tester); - deploy(application1, 8, 8, "d-3-3-3", tester); + deploy(application1, 8, 1, small, tester); + deploy(application1, 8, 1, large, tester); + deploy(application1, 8, 8, large, tester); } @Test @@ -98,10 +102,10 @@ public class MultigroupProvisioningTest { ApplicationId application1 = tester.makeApplicationId(); - tester.makeReadyNodes(10, "d-1-1-1"); + tester.makeReadyNodes(10, small); - deploy(application1, Capacity.fromNodeCount(1, Optional.of("d-1-1-1"), true, true), 1, tester); - deploy(application1, Capacity.fromNodeCount(2, Optional.of("d-1-1-1"), true, true), 2, tester); + deploy(application1, Capacity.fromCount(1, Optional.of(small), true, true), 1, tester); + deploy(application1, Capacity.fromCount(2, Optional.of(small), true, true), 2, tester); } @Test @@ -110,11 +114,11 @@ public class MultigroupProvisioningTest { ApplicationId application1 = tester.makeApplicationId(); - tester.makeReadyNodes(10, "d-1-1-1"); - tester.makeReadyNodes(10, "d-3-3-3"); + tester.makeReadyNodes(10, small); + tester.makeReadyNodes(10, large); - deploy(application1, Capacity.fromNodeCount(1, Optional.of("d-1-1-1"), true, true), 1, tester); - deploy(application1, Capacity.fromNodeCount(2, Optional.of("d-3-3-3"), true, true), 2, tester); + deploy(application1, Capacity.fromCount(1, Optional.of(small), true, true), 1, tester); + deploy(application1, Capacity.fromCount(2, Optional.of(large), true, true), 2, tester); } @Test @@ -123,11 +127,11 @@ public class MultigroupProvisioningTest { ApplicationId application1 = tester.makeApplicationId(); - tester.makeReadyNodes(10, "d-1-1-1"); - tester.makeReadyNodes(10, "d-3-3-3"); + tester.makeReadyNodes(10, small); + tester.makeReadyNodes(10, large); - deploy(application1, 8, 1, "d-1-1-1", tester); - deploy(application1, 8, 1, "d-3-3-3", tester); + deploy(application1, 8, 1, small, tester); + deploy(application1, 8, 1, large, tester); // Expire small nodes tester.advanceTime(Duration.ofDays(7)); @@ -136,19 +140,19 @@ public class MultigroupProvisioningTest { tester.clock(), Collections.singletonMap(application1, new MockDeployer.ApplicationContext(application1, cluster(), - Capacity.fromNodeCount(8, Optional.of("d-3-3-3"), false, true), 1))); + Capacity.fromCount(8, Optional.of(large), false, true), 1))); new RetiredExpirer(tester.nodeRepository(), tester.orchestrator(), deployer, tester.clock(), Duration.ofDays(30), Duration.ofHours(12)).run(); - assertEquals(8, tester.getNodes(application1, Node.State.inactive).resources(new NodeResources(1, 1, 1, 0.3)).size()); - deploy(application1, 8, 8, "d-3-3-3", tester); + assertEquals(8, tester.getNodes(application1, Node.State.inactive).resources(small).size()); + deploy(application1, 8, 8, large, tester); } - private void deploy(ApplicationId application, int nodeCount, int groupCount, String flavor, ProvisioningTester tester) { - deploy(application, Capacity.fromNodeCount(nodeCount, Optional.of(flavor), false, true), groupCount, tester); + private void deploy(ApplicationId application, int nodeCount, int groupCount, NodeResources resources, ProvisioningTester tester) { + deploy(application, Capacity.fromCount(nodeCount, Optional.of(resources), false, true), groupCount, tester); } private void deploy(ApplicationId application, int nodeCount, int groupCount, ProvisioningTester tester) { - deploy(application, Capacity.fromNodeCount(nodeCount, Optional.of("d-3-3-3"), false, true), groupCount, tester); + deploy(application, Capacity.fromCount(nodeCount, Optional.of(large), false, true), groupCount, tester); } private void deploy(ApplicationId application, Capacity capacity, int wantedGroups, ProvisioningTester tester) { diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java index 851a734674f..58440372821 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java @@ -438,7 +438,7 @@ public class ProvisioningTest { ClusterSpec.Id.from("music"), new com.yahoo.component.Version(4, 5, 6), false); - tester.prepare(application, cluster, Capacity.fromNodeCount(5, Optional.empty(), false, false), 1); + tester.prepare(application, cluster, Capacity.fromCount(5, Optional.empty(), false, false), 1); // No exception; Success } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTester.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTester.java index 50657e7eab2..844677395f4 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTester.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTester.java @@ -238,6 +238,9 @@ public class ProvisioningTester { public List<Node> makeReadyNodes(int n, String flavor, NodeType type) { return makeReadyNodes(n, asFlavor(flavor, type), type, 0); } + public List<Node> makeReadyNodes(int n, NodeResources resources, NodeType type) { + return makeReadyNodes(n, new Flavor(resources), type, 0); + } public List<Node> makeReadyNodes(int n, NodeResources resources, NodeType type, int ipAddressPoolSize) { return makeReadyNodes(n, new Flavor(resources), type, ipAddressPoolSize); } |