Search in sources :

Example 66 with ApplicationId

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());
}
Also used : Zone(com.yahoo.config.provision.Zone) Node(com.yahoo.vespa.hosted.provision.Node) ApplicationId(com.yahoo.config.provision.ApplicationId) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 67 with ApplicationId

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"));
    }
}
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 68 with ApplicationId

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;
}
Also used : ServiceMonitorStub(com.yahoo.vespa.hosted.provision.testutils.ServiceMonitorStub) HashMap(java.util.HashMap) ClusterSpec(com.yahoo.config.provision.ClusterSpec) ApplicationId(com.yahoo.config.provision.ApplicationId) MetricsReporterTest(com.yahoo.vespa.hosted.provision.monitoring.MetricsReporterTest) MockDeployer(com.yahoo.vespa.hosted.provision.testutils.MockDeployer)

Example 69 with ApplicationId

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;
}
Also used : ServiceMonitorStub(com.yahoo.vespa.hosted.provision.testutils.ServiceMonitorStub) HashMap(java.util.HashMap) Node(com.yahoo.vespa.hosted.provision.Node) ClusterSpec(com.yahoo.config.provision.ClusterSpec) Capacity(com.yahoo.config.provision.Capacity) ApplicationId(com.yahoo.config.provision.ApplicationId) MetricsReporterTest(com.yahoo.vespa.hosted.provision.monitoring.MetricsReporterTest) MockDeployer(com.yahoo.vespa.hosted.provision.testutils.MockDeployer)

Example 70 with ApplicationId

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;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ApplicationId(com.yahoo.config.provision.ApplicationId)

Aggregations

ApplicationId (com.yahoo.config.provision.ApplicationId)173 Test (org.junit.Test)102 Zone (com.yahoo.config.provision.Zone)52 Node (com.yahoo.vespa.hosted.provision.Node)30 ClusterSpec (com.yahoo.config.provision.ClusterSpec)22 TenantName (com.yahoo.config.provision.TenantName)20 Flavor (com.yahoo.config.provision.Flavor)19 List (java.util.List)16 HashSet (java.util.HashSet)15 HostSpec (com.yahoo.config.provision.HostSpec)12 Duration (java.time.Duration)12 HashMap (java.util.HashMap)12 Map (java.util.Map)12 Set (java.util.Set)12 Collectors (java.util.stream.Collectors)12 Version (com.yahoo.component.Version)11 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)11 Slime (com.yahoo.slime.Slime)11 ArrayList (java.util.ArrayList)11 Optional (java.util.Optional)11