use of com.yahoo.config.provision.Flavor in project vespa by vespa-engine.
the class DynamicDockerProvisioningTest method multiple_groups_are_on_separate_parent_hosts.
@Test(expected = OutOfCapacityException.class)
public void multiple_groups_are_on_separate_parent_hosts() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")), flavorsConfig());
tester.makeReadyNodes(5, "host-small", NodeType.host, 32);
deployZoneApp(tester);
Flavor flavor = tester.nodeRepository().getAvailableFlavors().getFlavorOrThrow("d-1");
// Deploy an application of 6 nodes of 3 nodes in each cluster. We only have 3 docker hosts available
ApplicationId application1 = tester.makeApplicationId();
tester.prepare(application1, ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("myContent"), Version.fromString("6.100"), false), 6, 2, flavor.canonicalName());
fail("Two groups have been allocated to the same parent host");
}
use of com.yahoo.config.provision.Flavor in project vespa by vespa-engine.
the class DynamicDockerProvisioningTest method non_prod_do_not_have_spares.
@Test
public void non_prod_do_not_have_spares() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.perf, RegionName.from("us-east")), flavorsConfig());
tester.makeReadyNodes(3, "host-small", NodeType.host, 32);
deployZoneApp(tester);
Flavor flavor = tester.nodeRepository().getAvailableFlavors().getFlavorOrThrow("d-3");
ApplicationId application1 = tester.makeApplicationId();
List<HostSpec> hosts = tester.prepare(application1, ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("myContent"), Version.fromString("6.100"), false), 3, 1, flavor.canonicalName());
tester.activate(application1, ImmutableSet.copyOf(hosts));
List<Node> initialSpareCapacity = findSpareCapacity(tester);
assertThat(initialSpareCapacity.size(), is(0));
}
use of com.yahoo.config.provision.Flavor in project vespa by vespa-engine.
the class ProvisioningTest method application_deployment_is_not_given_unallocated_nodes_having_retired_flavor.
@Test
public void application_deployment_is_not_given_unallocated_nodes_having_retired_flavor() {
String flavorToRetire = "default";
String replacementFlavor = "new-default";
FlavorConfigBuilder b = new FlavorConfigBuilder();
b.addFlavor(flavorToRetire, 1., 1., 10, Flavor.Type.BARE_METAL).cost(2).retired(true);
FlavorsConfig.Flavor.Builder newDefault = b.addFlavor(replacementFlavor, 2., 2., 20, Flavor.Type.BARE_METAL).cost(2);
b.addReplaces(flavorToRetire, newDefault);
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")), b.build());
ApplicationId application = tester.makeApplicationId();
// Add nodes
tester.makeReadyNodes(4, flavorToRetire);
tester.makeReadyNodes(4, replacementFlavor);
SystemState state = prepare(application, 2, 0, 2, 0, flavorToRetire, tester);
tester.activate(application, state.allHosts);
List<Node> nodes = tester.getNodes(application).asList();
assertTrue("Allocated nodes have flavor " + replacementFlavor, nodes.stream().allMatch(n -> n.flavor().name().equals(replacementFlavor)));
}
use of com.yahoo.config.provision.Flavor in project vespa by vespa-engine.
the class NodeRetirerTester method expectedCountsByFlavor.
private Map<Flavor, Long> expectedCountsByFlavor(long... nums) {
Map<Flavor, Long> countsByFlavor = new HashMap<>();
for (int i = 0; i < nums.length; i++) {
if (nums[i] < 0)
continue;
Flavor flavor = flavors.get(i);
countsByFlavor.put(flavor, nums[i]);
}
return countsByFlavor;
}
use of com.yahoo.config.provision.Flavor in project vespa by vespa-engine.
the class FlavorSpareCheckerTest method canRetireUnallocated_NoReadyForFlavor.
@Test
public void canRetireUnallocated_NoReadyForFlavor() {
Flavor flavorToRetire = flavors.get(0);
FlavorSpareCount flavorSpareCount = flavorSpareCountByFlavor.get(flavorToRetire);
when(spareNodesPolicy.hasSpare(flavorSpareCount)).thenReturn(true);
assertFalse(flavorSpareChecker.canRetireUnallocatedNodeWithFlavor(flavorToRetire));
verifyDecrement();
}
Aggregations