use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ProvisioningTest method out_of_desired_flavor.
@Test
public void out_of_desired_flavor() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
// need 2+2+3+3=10
tester.makeReadyNodes(10, "small");
// need 2+2+3+3=10
tester.makeReadyNodes(9, "large");
ApplicationId application = tester.makeApplicationId();
try {
prepare(application, 2, 2, 3, 3, "large", tester);
fail("Expected exception");
} catch (OutOfCapacityException e) {
assertTrue(e.getMessage().startsWith("Could not satisfy request for 3 nodes of flavor 'large'"));
}
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ProvisioningTest method application_deployment_extends_existing_reservations_on_deploy.
@Test
public void application_deployment_extends_existing_reservations_on_deploy() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
ApplicationId application = tester.makeApplicationId();
tester.makeReadyNodes(2, "default");
// Deploy fails with out of capacity
try {
prepare(application, 2, 0, 2, 0, "default", tester);
fail("Expected exception");
} catch (OutOfCapacityException ignored) {
}
assertEquals("Reserved a subset of required nodes", 2, tester.getNodes(application, Node.State.reserved).size());
// Enough nodes become available
tester.makeReadyNodes(2, "default");
// Deploy is retried after a few minutes
tester.clock().advance(Duration.ofMinutes(2));
SystemState state = prepare(application, 2, 0, 2, 0, "default", tester);
List<Node> reserved = tester.getNodes(application, Node.State.reserved).asList();
assertEquals("Reserved required nodes", 4, reserved.size());
assertTrue("Time of event is updated for all nodes", reserved.stream().allMatch(n -> n.history().event(History.Event.Type.reserved).get().at().equals(tester.clock().instant())));
// Over 10 minutes pass since first reservation. First set of reserved nodes are not expired
tester.clock().advance(Duration.ofMinutes(8).plus(Duration.ofSeconds(1)));
ReservationExpirer expirer = new ReservationExpirer(tester.nodeRepository(), tester.clock(), Duration.ofMinutes(10), new JobControl(tester.nodeRepository().database()));
expirer.run();
assertEquals("Nodes remain reserved", 4, tester.getNodes(application, Node.State.reserved).size());
tester.activate(application, state.allHosts);
assertEquals(4, tester.getNodes(application, Node.State.active).size());
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ProvisioningTest method test_deployment_flavor.
/**
* Test always uses the zone default flavor
*/
@Test
public void test_deployment_flavor() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.test, RegionName.from("us-east")));
ApplicationId application = tester.makeApplicationId();
tester.makeReadyNodes(4, "default");
SystemState state = prepare(application, 2, 2, 3, 3, "large", tester);
assertEquals(4, state.allHosts.size());
tester.activate(application, state.allHosts);
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ProvisioningTest method dev_deployment_flavor.
/**
* Dev always uses the zone default flavor
*/
@Test
public void dev_deployment_flavor() {
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, "large", tester);
assertEquals(4, state.allHosts.size());
tester.activate(application, state.allHosts);
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ProvisioningTest method application_deployment_multiple_flavors.
@Test
public void application_deployment_multiple_flavors() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
ApplicationId application1 = tester.makeApplicationId();
tester.makeReadyNodes(12, "small");
tester.makeReadyNodes(16, "large");
// deploy
SystemState state1 = prepare(application1, 2, 2, 4, 4, "small", tester);
tester.activate(application1, state1.allHosts);
// redeploy with reduced size (to cause us to have retired nodes before switching flavor)
SystemState state2 = prepare(application1, 2, 2, 3, 3, "small", tester);
tester.activate(application1, state2.allHosts);
// redeploy with increased sizes and new flavor
SystemState state3 = prepare(application1, 3, 4, 4, 5, "large", tester);
assertEquals("New nodes are reserved", 16, tester.nodeRepository().getNodes(application1, Node.State.reserved).size());
tester.activate(application1, state3.allHosts);
assertEquals("'small' container nodes are retired because we are swapping the entire cluster", 2 + 2, tester.getNodes(application1, Node.State.active).retired().type(ClusterSpec.Type.container).flavor("small").size());
assertEquals("'small' content nodes are retired", 4 + 4, tester.getNodes(application1, Node.State.active).retired().type(ClusterSpec.Type.content).flavor("small").size());
assertEquals("No 'large' content nodes are retired", 0, tester.getNodes(application1, Node.State.active).retired().flavor("large").size());
}
Aggregations