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;
}
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);
}
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());
}
Aggregations