use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class ProvisioningTest method application_deployment_with_inplace_downsize.
// TODO: Enable when this feature is re-enabled
@Ignore
@Test
public void application_deployment_with_inplace_downsize() {
ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
ApplicationId application1 = tester.makeApplicationId();
tester.makeReadyNodes(14, "dockerLarge");
// deploy
SystemState state1 = prepare(application1, 2, 2, 4, 4, "dockerLarge", tester);
tester.activate(application1, state1.allHosts);
// redeploy with smaller docker flavor - causes in-place flavor change
SystemState state2 = prepare(application1, 2, 2, 4, 4, "dockerSmall", tester);
tester.activate(application1, state2.allHosts);
assertEquals(12, tester.getNodes(application1, Node.State.active).asList().size());
for (Node node : tester.getNodes(application1, Node.State.active).asList()) assertEquals("Node changed flavor in place", "dockerSmall", node.flavor().name());
assertEquals("No nodes are retired", 0, tester.getNodes(application1, Node.State.active).retired().size());
}
use of com.yahoo.config.provision.ApplicationId 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"));
}
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class NodeFailTester method withTwoApplications.
public static NodeFailTester withTwoApplications(ConfigserverConfig configserverConfig) {
NodeFailTester tester = new NodeFailTester(configserverConfig);
tester.createReadyNodes(16);
tester.createHostNodes(3);
// Create applications
ClusterSpec clusterApp1 = ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from("test"), Version.fromString("6.42"), false);
ClusterSpec clusterApp2 = ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("test"), Version.fromString("6.42"), false);
int wantedNodesApp1 = 5;
int wantedNodesApp2 = 7;
tester.activate(app1, clusterApp1, wantedNodesApp1);
tester.activate(app2, clusterApp2, wantedNodesApp2);
assertEquals(wantedNodesApp1, tester.nodeRepository.getNodes(app1, Node.State.active).size());
assertEquals(wantedNodesApp2, tester.nodeRepository.getNodes(app2, Node.State.active).size());
Map<ApplicationId, MockDeployer.ApplicationContext> apps = new HashMap<>();
apps.put(app1, new MockDeployer.ApplicationContext(app1, clusterApp1, Capacity.fromNodeCount(wantedNodesApp1, Optional.of("default"), false), 1));
apps.put(app2, new MockDeployer.ApplicationContext(app2, clusterApp2, Capacity.fromNodeCount(wantedNodesApp2, Optional.of("default"), false), 1));
tester.deployer = new MockDeployer(tester.provisioner, apps);
tester.serviceMonitor = new ServiceMonitorStub(apps, tester.nodeRepository);
tester.metric = new MetricsReporterTest.TestMetric();
tester.failer = tester.createFailer();
return tester;
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class NodeFailTester method withTwoApplicationsOnDocker.
public static NodeFailTester withTwoApplicationsOnDocker(int numberOfHosts) {
NodeFailTester tester = new NodeFailTester();
int nodesPerHost = 3;
List<Node> hosts = tester.createHostNodes(numberOfHosts);
for (int i = 0; i < hosts.size(); i++) {
tester.createReadyNodes(nodesPerHost, i * nodesPerHost, Optional.of("parent" + i), nodeFlavors.getFlavorOrThrow("docker"), NodeType.tenant);
}
// Create applications
ClusterSpec clusterNodeAdminApp = ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from("node-admin"), Version.fromString("6.42"), false);
ClusterSpec clusterApp1 = ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from("test"), Version.fromString("6.75.0"), false);
ClusterSpec clusterApp2 = ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("test"), Version.fromString("6.75.0"), false);
Capacity allHosts = Capacity.fromRequiredNodeType(NodeType.host);
Capacity capacity1 = Capacity.fromNodeCount(3, Optional.of("docker"), false);
Capacity capacity2 = Capacity.fromNodeCount(5, Optional.of("docker"), false);
tester.activate(nodeAdminApp, clusterNodeAdminApp, allHosts);
tester.activate(app1, clusterApp1, capacity1);
tester.activate(app2, clusterApp2, capacity2);
assertEquals(new HashSet<>(tester.nodeRepository.getNodes(NodeType.host)), new HashSet<>(tester.nodeRepository.getNodes(nodeAdminApp, Node.State.active)));
assertEquals(capacity1.nodeCount(), tester.nodeRepository.getNodes(app1, Node.State.active).size());
assertEquals(capacity2.nodeCount(), tester.nodeRepository.getNodes(app2, Node.State.active).size());
Map<ApplicationId, MockDeployer.ApplicationContext> apps = new HashMap<>();
apps.put(nodeAdminApp, new MockDeployer.ApplicationContext(nodeAdminApp, clusterNodeAdminApp, allHosts, 1));
apps.put(app1, new MockDeployer.ApplicationContext(app1, clusterApp1, capacity1, 1));
apps.put(app2, new MockDeployer.ApplicationContext(app2, clusterApp2, capacity2, 1));
tester.deployer = new MockDeployer(tester.provisioner, apps);
tester.serviceMonitor = new ServiceMonitorStub(apps, tester.nodeRepository);
tester.metric = new MetricsReporterTest.TestMetric();
tester.failer = tester.createFailer();
return tester;
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class NodeRetirerTester method expectedCountsByApplication.
private Map<ApplicationId, Long> expectedCountsByApplication(long... nums) {
Map<ApplicationId, Long> countsByApplicationId = new HashMap<>();
Iterator<ApplicationId> iterator = apps.keySet().iterator();
for (int i = 0; iterator.hasNext(); i++) {
ApplicationId applicationId = iterator.next();
if (nums[i] < 0)
continue;
countsByApplicationId.put(applicationId, nums[i]);
}
return countsByApplicationId;
}
Aggregations