Search in sources :

Example 61 with Zone

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

the class DockerProvisioningTest method docker_application_deployment_with_exclusive_app_last.

/**
 * Non-exclusive app first, then an exclusive: Should give the same result as above
 */
@Test
public void docker_application_deployment_with_exclusive_app_last() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    for (int i = 1; i <= 4; i++) tester.makeReadyVirtualNode(i, dockerFlavor, "host1");
    for (int i = 5; i <= 8; i++) tester.makeReadyVirtualNode(i, dockerFlavor, "host2");
    for (int i = 9; i <= 12; i++) tester.makeReadyVirtualNode(i, dockerFlavor, "host3");
    for (int i = 13; i <= 16; i++) tester.makeReadyVirtualNode(i, dockerFlavor, "host4");
    ApplicationId application1 = tester.makeApplicationId();
    prepareAndActivate(application1, 2, false, tester);
    assertEquals(setOf("host1", "host2"), hostsOf(tester.getNodes(application1, Node.State.active)));
    ApplicationId application2 = tester.makeApplicationId();
    prepareAndActivate(application2, 2, true, tester);
    assertEquals("Application is assigned to separate hosts", setOf("host3", "host4"), hostsOf(tester.getNodes(application2, Node.State.active)));
}
Also used : Zone(com.yahoo.config.provision.Zone) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 62 with Zone

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

the class DockerProvisioningTest method get_specified_flavor_not_default_flavor_for_docker.

// In dev, test and staging you get nodes with default flavor, but we should get specified flavor for docker nodes
@Test
public void get_specified_flavor_not_default_flavor_for_docker() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.test, RegionName.from("corp-us-east-1")));
    ApplicationId application1 = tester.makeApplicationId();
    tester.makeReadyDockerNodes(1, dockerFlavor, "dockerHost");
    List<HostSpec> hosts = tester.prepare(application1, ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("myContent"), Version.fromString("6.42"), false), 1, 1, dockerFlavor);
    tester.activate(application1, new HashSet<>(hosts));
    NodeList nodes = tester.getNodes(application1, Node.State.active);
    assertEquals(1, nodes.size());
    assertEquals(dockerFlavor, nodes.asList().get(0).flavor().canonicalName());
}
Also used : Zone(com.yahoo.config.provision.Zone) NodeList(com.yahoo.vespa.hosted.provision.NodeList) ApplicationId(com.yahoo.config.provision.ApplicationId) HostSpec(com.yahoo.config.provision.HostSpec) Test(org.junit.Test)

Example 63 with Zone

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

the class DockerProvisioningTest method docker_application_deployment.

@Test
public void docker_application_deployment() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    ApplicationId application1 = tester.makeApplicationId();
    for (int i = 1; i < 10; i++) tester.makeReadyDockerNodes(1, dockerFlavor, "dockerHost" + i);
    Version wantedVespaVersion = Version.fromString("6.39");
    int nodeCount = 7;
    List<HostSpec> hosts = tester.prepare(application1, ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("myContent"), wantedVespaVersion, false), nodeCount, 1, dockerFlavor);
    tester.activate(application1, new HashSet<>(hosts));
    NodeList nodes = tester.getNodes(application1, Node.State.active);
    assertEquals(nodeCount, nodes.size());
    assertEquals(dockerFlavor, nodes.asList().get(0).flavor().canonicalName());
    // Upgrade Vespa version on nodes
    Version upgradedWantedVespaVersion = Version.fromString("6.40");
    List<HostSpec> upgradedHosts = tester.prepare(application1, ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("myContent"), upgradedWantedVespaVersion, false), nodeCount, 1, dockerFlavor);
    tester.activate(application1, new HashSet<>(upgradedHosts));
    NodeList upgradedNodes = tester.getNodes(application1, Node.State.active);
    assertEquals(nodeCount, upgradedNodes.size());
    assertEquals(dockerFlavor, upgradedNodes.asList().get(0).flavor().canonicalName());
    assertEquals(hosts, upgradedHosts);
}
Also used : Version(com.yahoo.component.Version) Zone(com.yahoo.config.provision.Zone) NodeList(com.yahoo.vespa.hosted.provision.NodeList) ApplicationId(com.yahoo.config.provision.ApplicationId) HostSpec(com.yahoo.config.provision.HostSpec) Test(org.junit.Test)

Example 64 with Zone

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

the class DockerProvisioningTest method docker_application_deployment_with_exclusive_app_first.

/**
 * Exclusive app first, then non-exclusive: Should give the same result as below
 */
@Test
public void docker_application_deployment_with_exclusive_app_first() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    for (int i = 1; i <= 4; i++) tester.makeReadyVirtualNode(i, dockerFlavor, "host1");
    for (int i = 5; i <= 8; i++) tester.makeReadyVirtualNode(i, dockerFlavor, "host2");
    for (int i = 9; i <= 12; i++) tester.makeReadyVirtualNode(i, dockerFlavor, "host3");
    for (int i = 13; i <= 16; i++) tester.makeReadyVirtualNode(i, dockerFlavor, "host4");
    ApplicationId application1 = tester.makeApplicationId();
    prepareAndActivate(application1, 2, true, tester);
    assertEquals(setOf("host1", "host2"), hostsOf(tester.getNodes(application1, Node.State.active)));
    ApplicationId application2 = tester.makeApplicationId();
    prepareAndActivate(application2, 2, false, tester);
    assertEquals("Application is assigned to separate hosts", setOf("host3", "host4"), hostsOf(tester.getNodes(application2, Node.State.active)));
}
Also used : Zone(com.yahoo.config.provision.Zone) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 65 with Zone

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

the class MultigroupProvisioningTest method test_provisioning_of_multiple_groups_after_flavor_migration.

@Test
public void test_provisioning_of_multiple_groups_after_flavor_migration() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    ApplicationId application1 = tester.makeApplicationId();
    tester.makeReadyNodes(10, "small");
    tester.makeReadyNodes(10, "large");
    deploy(application1, 8, 1, "small", tester);
    deploy(application1, 8, 1, "large", tester);
    deploy(application1, 8, 8, "large", tester);
}
Also used : Zone(com.yahoo.config.provision.Zone) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Aggregations

Zone (com.yahoo.config.provision.Zone)71 Test (org.junit.Test)64 ApplicationId (com.yahoo.config.provision.ApplicationId)51 Node (com.yahoo.vespa.hosted.provision.Node)17 Flavor (com.yahoo.config.provision.Flavor)15 ClusterSpec (com.yahoo.config.provision.ClusterSpec)13 HostSpec (com.yahoo.config.provision.HostSpec)12 OutOfCapacityException (com.yahoo.config.provision.OutOfCapacityException)10 HashSet (java.util.HashSet)8 DeployState (com.yahoo.config.model.deploy.DeployState)6 NestedTransaction (com.yahoo.transaction.NestedTransaction)6 Curator (com.yahoo.vespa.curator.Curator)6 MockCurator (com.yahoo.vespa.curator.mock.MockCurator)6 NodeList (com.yahoo.vespa.hosted.provision.NodeList)6 MockNameResolver (com.yahoo.vespa.hosted.provision.testutils.MockNameResolver)6 ConfigserverConfig (com.yahoo.cloud.config.ConfigserverConfig)5 Version (com.yahoo.component.Version)5 RegionName (com.yahoo.config.provision.RegionName)5 TenantName (com.yahoo.config.provision.TenantName)5 FlavorsConfig (com.yahoo.config.provisioning.FlavorsConfig)5