Search in sources :

Example 51 with Zone

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"));
    }
}
Also used : Zone(com.yahoo.config.provision.Zone) NestedTransaction(com.yahoo.transaction.NestedTransaction) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 52 with Zone

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)));
    }
}
Also used : MockNameResolver(com.yahoo.vespa.hosted.provision.testutils.MockNameResolver) Zone(com.yahoo.config.provision.Zone) NodeList(com.yahoo.vespa.hosted.provision.NodeList) Curator(com.yahoo.vespa.curator.Curator) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) ApplicationId(com.yahoo.config.provision.ApplicationId) FlavorsConfig(com.yahoo.config.provisioning.FlavorsConfig) NameResolver(com.yahoo.vespa.hosted.provision.persistence.NameResolver) MockNameResolver(com.yahoo.vespa.hosted.provision.testutils.MockNameResolver) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Test(org.junit.Test)

Example 53 with Zone

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());
    }
}
Also used : Zone(com.yahoo.config.provision.Zone) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 54 with Zone

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());
}
Also used : Zone(com.yahoo.config.provision.Zone) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 55 with Zone

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) {
    }
}
Also used : Zone(com.yahoo.config.provision.Zone) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Aggregations

Zone (com.yahoo.config.provision.Zone)71 Test (org.junit.Test)64 ApplicationId (com.yahoo.config.provision.ApplicationId)51 Node (com.yahoo.vespa.hosted.provision.Node)17 Flavor (com.yahoo.config.provision.Flavor)15 ClusterSpec (com.yahoo.config.provision.ClusterSpec)13 HostSpec (com.yahoo.config.provision.HostSpec)12 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)10 HashSet (java.util.HashSet)8 DeployState (com.yahoo.config.model.deploy.DeployState)6 NestedTransaction (com.yahoo.transaction.NestedTransaction)6 Curator (com.yahoo.vespa.curator.Curator)6 MockCurator (com.yahoo.vespa.curator.mock.MockCurator)6 NodeList (com.yahoo.vespa.hosted.provision.NodeList)6 MockNameResolver (com.yahoo.vespa.hosted.provision.testutils.MockNameResolver)6 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)5 Version (com.yahoo.component.Version)5 RegionName (com.yahoo.config.provision.RegionName)5 TenantName (com.yahoo.config.provision.TenantName)5 FlavorsConfig (com.yahoo.config.provisioning.FlavorsConfig)5