use of com.yahoo.vespa.hosted.provision.testutils.ServiceMonitorStub 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.vespa.hosted.provision.testutils.ServiceMonitorStub 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.vespa.hosted.provision.testutils.ServiceMonitorStub in project vespa by vespa-engine.
the class NodeFailTester method withProxyApplication.
public static NodeFailTester withProxyApplication() {
NodeFailTester tester = new NodeFailTester();
tester.createReadyNodes(16, NodeType.proxy);
// Create application
Capacity allProxies = Capacity.fromRequiredNodeType(NodeType.proxy);
ClusterSpec clusterApp1 = ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from("test"), Version.fromString("6.42"), false);
tester.activate(app1, clusterApp1, allProxies);
assertEquals(16, tester.nodeRepository.getNodes(NodeType.proxy, Node.State.active).size());
Map<ApplicationId, MockDeployer.ApplicationContext> apps = new HashMap<>();
apps.put(app1, new MockDeployer.ApplicationContext(app1, clusterApp1, allProxies, 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.vespa.hosted.provision.testutils.ServiceMonitorStub in project vespa by vespa-engine.
the class NodeFailTester method withNoApplications.
public static NodeFailTester withNoApplications() {
NodeFailTester tester = new NodeFailTester();
tester.deployer = new MockDeployer(tester.provisioner, Collections.emptyMap());
tester.serviceMonitor = new ServiceMonitorStub(Collections.emptyMap(), tester.nodeRepository);
tester.metric = new MetricsReporterTest.TestMetric();
tester.failer = tester.createFailer();
return tester;
}
Aggregations