use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ProvisioningTest method activate_after_reservation_timeout.
@Test
public void activate_after_reservation_timeout() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
tester.makeReadyNodes(10, "default");
ApplicationId application = tester.makeApplicationId();
SystemState state = prepare(application, 2, 2, 3, 3, "default", tester);
// Simulate expiry
NestedTransaction deactivateTransaction = new NestedTransaction();
tester.nodeRepository().deactivate(application, deactivateTransaction);
deactivateTransaction.commit();
try {
tester.activate(application, state.allHosts);
fail("Expected exception");
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().startsWith("Activation of " + application + " failed"));
}
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ProvisioningTest method application_deployment_retires_nodes_having_retired_flavor.
@Test
public void application_deployment_retires_nodes_having_retired_flavor() {
String flavorToRetire = "default";
String replacementFlavor = "new-default";
ApplicationId application = ApplicationId.from(TenantName.from(UUID.randomUUID().toString()), ApplicationName.from(UUID.randomUUID().toString()), InstanceName.from(UUID.randomUUID().toString()));
Curator curator = new MockCurator();
NameResolver nameResolver = new MockNameResolver().mockAnyLookup();
// Deploy with flavor that will eventually be retired
{
FlavorConfigBuilder b = new FlavorConfigBuilder();
b.addFlavor("default", 1., 1., 10, Flavor.Type.BARE_METAL).cost(2);
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")), b.build(), curator, nameResolver);
tester.makeReadyNodes(4, flavorToRetire);
SystemState state = prepare(application, 2, 0, 2, 0, flavorToRetire, tester);
tester.activate(application, state.allHosts);
}
// Re-deploy with same flavor, which is now retired
{
// Retire "default" flavor and add "new-default" as replacement
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(), curator, nameResolver);
// Add nodes with "new-default" flavor
tester.makeReadyNodes(4, replacementFlavor);
SystemState state = prepare(application, 2, 0, 2, 0, flavorToRetire, tester);
tester.activate(application, state.allHosts);
// Nodes with retired flavor are retired
NodeList retired = tester.getNodes(application).retired();
assertEquals(4, retired.size());
assertTrue("Nodes are retired by system", retired.asList().stream().allMatch(retiredBy(Agent.system)));
}
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ProvisioningTest method nonexisting_flavor.
@Test
public void nonexisting_flavor() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
ApplicationId application = tester.makeApplicationId();
try {
prepare(application, 2, 2, 3, 3, "nonexisting", tester);
fail("Expected exception");
} catch (IllegalArgumentException e) {
assertEquals("Unknown flavor 'nonexisting'. Flavors are [default, dockerLarge, dockerSmall, large, old-large1, old-large2, small, v-4-8-100]", e.getMessage());
}
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ProvisioningTest method highest_node_indexes_are_retired_first.
@Test
public void highest_node_indexes_are_retired_first() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
ApplicationId application1 = tester.makeApplicationId();
tester.makeReadyNodes(14, "default");
// deploy
SystemState state1 = prepare(application1, 3, 3, 4, 4, "default", tester);
tester.activate(application1, state1.allHosts);
// decrease cluster sizes
SystemState state2 = prepare(application1, 2, 2, 2, 2, "default", tester);
tester.activate(application1, state2.allHosts);
// content0
assertFalse(state2.hostByMembership("content0", 0, 0).membership().get().retired());
assertFalse(state2.hostByMembership("content0", 0, 1).membership().get().retired());
assertTrue(state2.hostByMembership("content0", 0, 2).membership().get().retired());
assertTrue(state2.hostByMembership("content0", 0, 3).membership().get().retired());
// content1
assertFalse(state2.hostByMembership("content1", 0, 0).membership().get().retired());
assertFalse(state2.hostByMembership("content1", 0, 1).membership().get().retired());
assertTrue(state2.hostByMembership("content1", 0, 2).membership().get().retired());
assertTrue(state2.hostByMembership("content1", 0, 3).membership().get().retired());
}
use of com.yahoo.config.provision.Zone in project vespa by vespa-engine.
the class ProvisioningTest method required_capacity_respects_prod_redundancy_requirement.
@Test
public void required_capacity_respects_prod_redundancy_requirement() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
ApplicationId application = tester.makeApplicationId();
try {
prepare(application, 1, 0, 1, 0, true, "default", Version.fromString("6.42"), tester);
fail("Expected exception");
} catch (IllegalArgumentException ignored) {
}
}
Aggregations