Search in sources :

Example 6 with Flavor

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

Example 7 with Flavor

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

Example 8 with Flavor

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)));
}
Also used : Capacity(com.yahoo.config.provision.Capacity) InstanceName(com.yahoo.config.provision.InstanceName) ApplicationName(com.yahoo.config.provision.ApplicationName) Version(com.yahoo.component.Version) ApplicationId(com.yahoo.config.provision.ApplicationId) ClusterMembership(com.yahoo.config.provision.ClusterMembership) ClusterSpec(com.yahoo.config.provision.ClusterSpec) Node(com.yahoo.vespa.hosted.provision.Node) ConfigserverConfig(com.yahoo.cloud.config.ConfigserverConfig) Function(java.util.function.Function) RegionName(com.yahoo.config.provision.RegionName) NameResolver(com.yahoo.vespa.hosted.provision.persistence.NameResolver) TenantName(com.yahoo.config.provision.TenantName) Curator(com.yahoo.vespa.curator.Curator) HashSet(java.util.HashSet) ReservationExpirer(com.yahoo.vespa.hosted.provision.maintenance.ReservationExpirer) History(com.yahoo.vespa.hosted.provision.node.History) NestedTransaction(com.yahoo.transaction.NestedTransaction) Duration(java.time.Duration) NodeList(com.yahoo.vespa.hosted.provision.NodeList) Assert.fail(org.junit.Assert.fail) NodeFlavors(com.yahoo.config.provision.NodeFlavors) Iterator(java.util.Iterator) Environment(com.yahoo.config.provision.Environment) Predicate(java.util.function.Predicate) OutOfCapacityException(com.yahoo.config.provision.OutOfCapacityException) JobControl(com.yahoo.vespa.hosted.provision.maintenance.JobControl) HostSpec(com.yahoo.config.provision.HostSpec) FlavorsConfig(com.yahoo.config.provisioning.FlavorsConfig) MockNameResolver(com.yahoo.vespa.hosted.provision.testutils.MockNameResolver) Set(java.util.Set) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) HostFilter(com.yahoo.config.provision.HostFilter) List(java.util.List) Agent(com.yahoo.vespa.hosted.provision.node.Agent) Ignore(org.junit.Ignore) Flavor(com.yahoo.config.provision.Flavor) Assert.assertFalse(org.junit.Assert.assertFalse) Zone(com.yahoo.config.provision.Zone) Optional(java.util.Optional) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) Zone(com.yahoo.config.provision.Zone) Node(com.yahoo.vespa.hosted.provision.Node) ApplicationId(com.yahoo.config.provision.ApplicationId) Flavor(com.yahoo.config.provision.Flavor) Test(org.junit.Test)

Example 9 with Flavor

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;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Flavor(com.yahoo.config.provision.Flavor)

Example 10 with Flavor

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

Aggregations

Flavor (com.yahoo.config.provision.Flavor)35 Test (org.junit.Test)23 ApplicationId (com.yahoo.config.provision.ApplicationId)17 Node (com.yahoo.vespa.hosted.provision.Node)16 ClusterSpec (com.yahoo.config.provision.ClusterSpec)12 Zone (com.yahoo.config.provision.Zone)12 HashSet (java.util.HashSet)8 List (java.util.List)8 HashMap (java.util.HashMap)7 Set (java.util.Set)7 Optional (java.util.Optional)6 Collectors (java.util.stream.Collectors)6 Duration (java.time.Duration)5 ArrayList (java.util.ArrayList)5 HostSpec (com.yahoo.config.provision.HostSpec)4 NodeFlavors (com.yahoo.config.provision.NodeFlavors)4 NodeType (com.yahoo.config.provision.NodeType)4 Agent (com.yahoo.vespa.hosted.provision.node.Agent)4 Iterator (java.util.Iterator)4 Version (com.yahoo.component.Version)3