use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class ProvisioningTest method out_of_capacity_no_replacements_for_retired_flavor.
@Test
public void out_of_capacity_no_replacements_for_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();
try {
prepare(application, 2, 0, 2, 0, flavorToRetire, tester);
fail("Expected exception");
} catch (OutOfCapacityException e) {
assertTrue(e.getMessage().startsWith("Could not satisfy request"));
}
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class ProvisioningTest method application_deployment_multiple_flavors_default_per_type.
@Test
public void application_deployment_multiple_flavors_default_per_type() {
ConfigserverConfig.Builder config = new ConfigserverConfig.Builder();
config.environment("prod");
config.region("us-east");
config.defaultFlavor("not-used");
config.defaultContainerFlavor("small");
config.defaultContentFlavor("large");
ProvisioningTester tester = new ProvisioningTester(new Zone(new ConfigserverConfig(config), new NodeFlavors(new FlavorsConfig(new FlavorsConfig.Builder()))));
ApplicationId application1 = tester.makeApplicationId();
tester.makeReadyNodes(10, "small");
tester.makeReadyNodes(9, "large");
// deploy
SystemState state1 = prepare(application1, 2, 3, 4, 5, null, tester);
tester.activate(application1, state1.allHosts);
assertEquals("'small' nodes are used for containers", 2 + 3, tester.getNodes(application1, Node.State.active).flavor("small").size());
assertEquals("'large' nodes are used for content", 4 + 5, tester.getNodes(application1, Node.State.active).flavor("large").size());
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class ProvisioningTest method dev_deployment_size.
@Test
public void dev_deployment_size() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.dev, RegionName.from("us-east")));
ApplicationId application = tester.makeApplicationId();
tester.makeReadyNodes(4, "default");
SystemState state = prepare(application, 2, 2, 3, 3, "default", tester);
assertEquals(4, state.allHosts.size());
tester.activate(application, state.allHosts);
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class ProvisioningTest method application_deployment_retires_nodes_that_want_to_retire.
@Test
public void application_deployment_retires_nodes_that_want_to_retire() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
ApplicationId application = tester.makeApplicationId();
tester.makeReadyNodes(10, "default");
// Deploy application
{
SystemState state = prepare(application, 2, 0, 2, 0, "default", tester);
tester.activate(application, state.allHosts);
assertEquals(4, tester.getNodes(application, Node.State.active).size());
}
// Retire some nodes and redeploy
{
List<Node> nodesToRetire = tester.getNodes(application, Node.State.active).asList().subList(0, 2);
nodesToRetire.forEach(node -> tester.patchNode(node.with(node.status().withWantToRetire(true))));
SystemState state = prepare(application, 2, 0, 2, 0, "default", tester);
tester.activate(application, state.allHosts);
List<Node> retiredNodes = tester.getNodes(application).retired().asList();
assertEquals(2, retiredNodes.size());
assertTrue("Nodes are retired by system", retiredNodes.stream().allMatch(retiredBy(Agent.system)));
}
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class ProvisioningTest method application_deployment_constant_application_size.
@Test
public void application_deployment_constant_application_size() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
ApplicationId application1 = tester.makeApplicationId();
ApplicationId application2 = tester.makeApplicationId();
tester.makeReadyNodes(21, "default");
// deploy
SystemState state1 = prepare(application1, 2, 2, 3, 3, "default", tester);
tester.activate(application1, state1.allHosts);
// redeploy
SystemState state2 = prepare(application1, 2, 2, 3, 3, "default", tester);
state2.assertEquals(state1);
tester.activate(application1, state2.allHosts);
// deploy another application
SystemState state1App2 = prepare(application2, 2, 2, 3, 3, "default", tester);
assertFalse("Hosts to different apps are disjunct", state1App2.allHosts.removeAll(state1.allHosts));
tester.activate(application2, state1App2.allHosts);
// prepare twice
SystemState state3 = prepare(application1, 2, 2, 3, 3, "default", tester);
SystemState state4 = prepare(application1, 2, 2, 3, 3, "default", tester);
state3.assertEquals(state2);
state4.assertEquals(state3);
tester.activate(application1, state4.allHosts);
// remove nodes before deploying
SystemState state5 = prepare(application1, 2, 2, 3, 3, "default", tester);
HostSpec removed = tester.removeOne(state5.allHosts);
tester.activate(application1, state5.allHosts);
assertEquals(removed.hostname(), tester.nodeRepository().getNodes(application1, Node.State.inactive).get(0).hostname());
// remove some of the clusters
SystemState state6 = prepare(application1, 0, 2, 0, 3, "default", tester);
tester.activate(application1, state6.allHosts);
assertEquals(5, tester.getNodes(application1, Node.State.active).size());
assertEquals(5, tester.getNodes(application1, Node.State.inactive).size());
// delete app
NestedTransaction removeTransaction = new NestedTransaction();
tester.provisioner().remove(removeTransaction, application1);
removeTransaction.commit();
assertEquals(tester.toHostNames(state1.allHosts), tester.toHostNames(tester.nodeRepository().getNodes(application1, Node.State.inactive)));
assertEquals(0, tester.getNodes(application1, Node.State.active).size());
// other application is unaffected
assertEquals(state1App2.hostNames(), tester.toHostNames(tester.nodeRepository().getNodes(application2, Node.State.active)));
// fail a node from app2 and make sure it does not get inactive nodes from first
HostSpec failed = tester.removeOne(state1App2.allHosts);
tester.fail(failed);
assertEquals(9, tester.getNodes(application2, Node.State.active).size());
SystemState state2App2 = prepare(application2, 2, 2, 3, 3, "default", tester);
assertFalse("Hosts to different apps are disjunct", state2App2.allHosts.removeAll(state1.allHosts));
assertEquals("A new node was reserved to replace the failed one", 10, state2App2.allHosts.size());
assertFalse("The new host is not the failed one", state2App2.allHosts.contains(failed));
tester.activate(application2, state2App2.allHosts);
// deploy first app again
SystemState state7 = prepare(application1, 2, 2, 3, 3, "default", tester);
state7.assertEquals(state1);
tester.activate(application1, state7.allHosts);
assertEquals(0, tester.getNodes(application1, Node.State.inactive).size());
// restart
HostFilter allFilter = HostFilter.all();
HostFilter hostFilter = HostFilter.hostname(state6.allHosts.iterator().next().hostname());
HostFilter clusterTypeFilter = HostFilter.clusterType(ClusterSpec.Type.container);
HostFilter clusterIdFilter = HostFilter.clusterId(ClusterSpec.Id.from("container1"));
tester.provisioner().restart(application1, allFilter);
tester.provisioner().restart(application1, hostFilter);
tester.provisioner().restart(application1, clusterTypeFilter);
tester.provisioner().restart(application1, clusterIdFilter);
tester.assertRestartCount(application1, allFilter, hostFilter, clusterTypeFilter, clusterIdFilter);
}
Aggregations