Search in sources :

Example 31 with HostSpec

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

the class ProvisioningTester method removeOne.

HostSpec removeOne(Set<HostSpec> hosts) {
    Iterator<HostSpec> i = hosts.iterator();
    HostSpec removed = i.next();
    i.remove();
    return removed;
}
Also used : HostSpec(com.yahoo.config.provision.HostSpec)

Example 32 with HostSpec

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

the class VirtualNodeProvisioningTest method fail_when_all_hosts_become_clashing.

@Test
public void fail_when_all_hosts_become_clashing() {
    tester.makeReadyVirtualNodes(1, flavor, "parentHost1");
    tester.makeReadyVirtualNodes(1, flavor, "parentHost2");
    tester.makeReadyVirtualNodes(1, flavor, "parentHost3");
    tester.makeReadyVirtualNodes(1, flavor, "parentHost4");
    int containerNodeCount = 2;
    int contentNodeCount = 2;
    int groups = 1;
    List<HostSpec> containerHosts = prepare(containerClusterSpec, containerNodeCount, groups);
    List<HostSpec> contentHosts = prepare(contentClusterSpec, contentNodeCount, groups);
    activate(containerHosts, contentHosts);
    List<Node> nodes = getNodes(applicationId);
    assertEquals(4, nodes.size());
    assertDistinctParentHosts(nodes, ClusterSpec.Type.container, containerNodeCount);
    assertDistinctParentHosts(nodes, ClusterSpec.Type.content, contentNodeCount);
    for (Node n : nodes) {
        tester.patchNode(n.withParentHostname("clashing"));
    }
    OutOfCapacityException expected = null;
    try {
        containerHosts = prepare(containerClusterSpec, containerNodeCount, groups);
    } catch (OutOfCapacityException e) {
        expected = e;
    }
    assertNotNull(expected);
}
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 33 with HostSpec

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

the class InactiveAndFailedExpirerTest method reboot_generation_is_increased_when_node_moves_to_dirty.

@Test
public void reboot_generation_is_increased_when_node_moves_to_dirty() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    List<Node> nodes = tester.makeReadyNodes(2, "default");
    // Allocate and deallocate a single node
    ClusterSpec cluster = ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("test"), Version.fromString("6.42"), false);
    List<HostSpec> preparedNodes = tester.prepare(applicationId, cluster, Capacity.fromNodeCount(2), 1);
    tester.activate(applicationId, new HashSet<>(preparedNodes));
    assertEquals(2, tester.getNodes(applicationId, Node.State.active).size());
    tester.deactivate(applicationId);
    List<Node> inactiveNodes = tester.getNodes(applicationId, Node.State.inactive).asList();
    assertEquals(2, inactiveNodes.size());
    // Check reboot generation before node is moved. New nodes transition from provisioned to dirty, so their
    // wanted reboot generation will always be 1.
    long wantedRebootGeneration = inactiveNodes.get(0).status().reboot().wanted();
    assertEquals(1, wantedRebootGeneration);
    // Inactive times out and node is moved to dirty
    tester.advanceTime(Duration.ofMinutes(14));
    new InactiveExpirer(tester.nodeRepository(), tester.clock(), Duration.ofMinutes(10), new JobControl(tester.nodeRepository().database())).run();
    List<Node> dirty = tester.nodeRepository().getNodes(Node.State.dirty);
    assertEquals(2, dirty.size());
    // Reboot generation is increased
    assertEquals(wantedRebootGeneration + 1, dirty.get(0).status().reboot().wanted());
}
Also used : Zone(com.yahoo.config.provision.Zone) Node(com.yahoo.vespa.hosted.provision.Node) ProvisioningTester(com.yahoo.vespa.hosted.provision.provisioning.ProvisioningTester) ClusterSpec(com.yahoo.config.provision.ClusterSpec) HostSpec(com.yahoo.config.provision.HostSpec) Test(org.junit.Test)

Aggregations

HostSpec (com.yahoo.config.provision.HostSpec)33 Test (org.junit.Test)18 Zone (com.yahoo.config.provision.Zone)14 ApplicationId (com.yahoo.config.provision.ApplicationId)13 Node (com.yahoo.vespa.hosted.provision.Node)12 ClusterSpec (com.yahoo.config.provision.ClusterSpec)10 HashSet (java.util.HashSet)7 NestedTransaction (com.yahoo.transaction.NestedTransaction)6 Version (com.yahoo.component.Version)5 Capacity (com.yahoo.config.provision.Capacity)5 Flavor (com.yahoo.config.provision.Flavor)5 List (java.util.List)5 ClusterMembership (com.yahoo.config.provision.ClusterMembership)4 Environment (com.yahoo.config.provision.Environment)4 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)4 Collections (java.util.Collections)4 RegionName (com.yahoo.config.provision.RegionName)3 NodeList (com.yahoo.vespa.hosted.provision.NodeList)3 JobControl (com.yahoo.vespa.hosted.provision.maintenance.JobControl)3 Agent (com.yahoo.vespa.hosted.provision.node.Agent)3