Search in sources :

Example 6 with OutOfCapacityException

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

Example 7 with OutOfCapacityException

use of com.yahoo.config.provision.OutOfCapacityException in project vespa by vespa-engine.

the class ProvisioningTest method out_of_capacity.

@Test
public void out_of_capacity() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    // need 2+2+3+3=10
    tester.makeReadyNodes(9, "default");
    ApplicationId application = tester.makeApplicationId();
    try {
        prepare(application, 2, 2, 3, 3, "default", tester);
        fail("Expected exception");
    } catch (OutOfCapacityException e) {
        assertTrue(e.getMessage().startsWith("Could not satisfy request"));
    }
}
Also used : Zone(com.yahoo.config.provision.Zone) OutOfCapacityException(com.yahoo.config.provision.OutOfCapacityException) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 8 with OutOfCapacityException

use of com.yahoo.config.provision.OutOfCapacityException in project vespa by vespa-engine.

the class VirtualNodeProvisioningTest method indistinct_distribution_with_known_ready_nodes.

@Test
public void indistinct_distribution_with_known_ready_nodes() {
    tester.makeReadyVirtualNodes(3, flavor, Optional.empty());
    final int contentNodeCount = 3;
    final int groups = 1;
    final List<HostSpec> contentHosts = prepare(contentClusterSpec, contentNodeCount, groups);
    activate(contentHosts);
    List<Node> nodes = getNodes(applicationId);
    assertEquals(3, nodes.size());
    // Set indistinct parents
    tester.patchNode(nodes.get(0).withParentHostname("parentHost1"));
    tester.patchNode(nodes.get(1).withParentHostname("parentHost1"));
    tester.patchNode(nodes.get(2).withParentHostname("parentHost2"));
    nodes = getNodes(applicationId);
    assertEquals(3, nodes.stream().filter(n -> n.parentHostname().isPresent()).count());
    tester.makeReadyVirtualNodes(1, flavor, "parentHost1");
    tester.makeReadyVirtualNodes(2, flavor, "parentHost2");
    OutOfCapacityException expectedException = null;
    try {
        prepare(contentClusterSpec, contentNodeCount, groups);
    } catch (OutOfCapacityException e) {
        expectedException = e;
    }
    assertNotNull(expectedException);
}
Also used : Node(com.yahoo.vespa.hosted.provision.Node) OutOfCapacityException(com.yahoo.config.provision.OutOfCapacityException) HostSpec(com.yahoo.config.provision.HostSpec) Test(org.junit.Test)

Example 9 with OutOfCapacityException

use of com.yahoo.config.provision.OutOfCapacityException in project vespa by vespa-engine.

the class ProvisioningTest method out_of_capacity_all_nodes_want_to_retire.

@Test
public void out_of_capacity_all_nodes_want_to_retire() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    ApplicationId application = tester.makeApplicationId();
    // Flag all nodes for retirement
    List<Node> readyNodes = tester.makeReadyNodes(5, "default");
    readyNodes.forEach(node -> tester.patchNode(node.with(node.status().withWantToRetire(true))));
    try {
        prepare(application, 2, 0, 2, 0, "default", tester);
        fail("Expected exception");
    } catch (OutOfCapacityException e) {
        assertTrue(e.getMessage().startsWith("Could not satisfy request"));
    }
}
Also used : Zone(com.yahoo.config.provision.Zone) Node(com.yahoo.vespa.hosted.provision.Node) OutOfCapacityException(com.yahoo.config.provision.OutOfCapacityException) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 10 with OutOfCapacityException

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

Aggregations

OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)14 Test (org.junit.Test)11 ApplicationId (com.yahoo.config.provision.ApplicationId)8 Zone (com.yahoo.config.provision.Zone)8 Node (com.yahoo.vespa.hosted.provision.Node)5 HostSpec (com.yahoo.config.provision.HostSpec)4 Flavor (com.yahoo.config.provision.Flavor)3 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)1 Version (com.yahoo.component.Version)1 AllocatedHosts (com.yahoo.config.provision.AllocatedHosts)1 ApplicationLockException (com.yahoo.config.provision.ApplicationLockException)1 ApplicationName (com.yahoo.config.provision.ApplicationName)1 Capacity (com.yahoo.config.provision.Capacity)1 ClusterMembership (com.yahoo.config.provision.ClusterMembership)1 ClusterSpec (com.yahoo.config.provision.ClusterSpec)1 Environment (com.yahoo.config.provision.Environment)1 HostFilter (com.yahoo.config.provision.HostFilter)1 InstanceName (com.yahoo.config.provision.InstanceName)1 NodeFlavors (com.yahoo.config.provision.NodeFlavors)1 RegionName (com.yahoo.config.provision.RegionName)1