Search in sources :

Example 26 with Zone

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

the class DockerProvisioningTest method docker_application_deployment_change_to_exclusive_and_back.

/**
 * Test making an application exclusive
 */
@Test
public void docker_application_deployment_change_to_exclusive_and_back() {
    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);
    for (Node node : tester.getNodes(application1, Node.State.active).asList()) assertFalse(node.allocation().get().membership().cluster().isExclusive());
    prepareAndActivate(application1, 2, true, tester);
    assertEquals(setOf("host1", "host2"), hostsOf(tester.getNodes(application1, Node.State.active)));
    for (Node node : tester.getNodes(application1, Node.State.active).asList()) assertTrue(node.allocation().get().membership().cluster().isExclusive());
    prepareAndActivate(application1, 2, false, tester);
    assertEquals(setOf("host1", "host2"), hostsOf(tester.getNodes(application1, Node.State.active)));
    for (Node node : tester.getNodes(application1, Node.State.active).asList()) assertFalse(node.allocation().get().membership().cluster().isExclusive());
}
Also used : Zone(com.yahoo.config.provision.Zone) Node(com.yahoo.vespa.hosted.provision.Node) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 27 with Zone

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

the class MultigroupProvisioningTest method test_provisioning_of_multiple_groups.

@Test
public void test_provisioning_of_multiple_groups() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    ApplicationId application1 = tester.makeApplicationId();
    tester.makeReadyNodes(21, "default");
    deploy(application1, 6, 1, tester);
    deploy(application1, 6, 2, tester);
    deploy(application1, 6, 3, tester);
    deploy(application1, 6, 6, tester);
    deploy(application1, 6, 1, tester);
    deploy(application1, 6, 6, tester);
    deploy(application1, 6, 6, tester);
    deploy(application1, 6, 2, tester);
    deploy(application1, 8, 2, tester);
    deploy(application1, 9, 3, tester);
    deploy(application1, 9, 3, tester);
    deploy(application1, 9, 3, tester);
    deploy(application1, 12, 4, tester);
    deploy(application1, 8, 4, tester);
    deploy(application1, 12, 4, tester);
    deploy(application1, 8, 2, tester);
    deploy(application1, 6, 3, tester);
}
Also used : Zone(com.yahoo.config.provision.Zone) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 28 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_and_exiration.

@Test
public void test_provisioning_of_multiple_groups_after_flavor_migration_and_exiration() {
    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);
    // Expire small nodes
    tester.advanceTime(Duration.ofDays(7));
    MockDeployer deployer = new MockDeployer(tester.provisioner(), Collections.singletonMap(application1, new MockDeployer.ApplicationContext(application1, cluster(), Capacity.fromNodeCount(8, Optional.of("large"), false), 1)));
    new RetiredExpirer(tester.nodeRepository(), tester.orchestrator(), deployer, tester.clock(), Duration.ofDays(30), Duration.ofHours(12), new JobControl(tester.nodeRepository().database())).run();
    assertEquals(8, tester.getNodes(application1, Node.State.inactive).flavor("small").size());
    deploy(application1, 8, 8, "large", tester);
}
Also used : Zone(com.yahoo.config.provision.Zone) JobControl(com.yahoo.vespa.hosted.provision.maintenance.JobControl) RetiredExpirer(com.yahoo.vespa.hosted.provision.maintenance.RetiredExpirer) ApplicationId(com.yahoo.config.provision.ApplicationId) MockDeployer(com.yahoo.vespa.hosted.provision.testutils.MockDeployer) Test(org.junit.Test)

Example 29 with Zone

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

the class MultigroupProvisioningTest method test_one_node_and_group_to_two_with_flavor_migration.

@Test
public void test_one_node_and_group_to_two_with_flavor_migration() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.perf, RegionName.from("us-east")));
    ApplicationId application1 = tester.makeApplicationId();
    tester.makeReadyNodes(10, "small");
    tester.makeReadyNodes(10, "large");
    deploy(application1, Capacity.fromNodeCount(1, Optional.of("small"), true), 1, tester);
    deploy(application1, Capacity.fromNodeCount(2, Optional.of("large"), true), 2, tester);
}
Also used : Zone(com.yahoo.config.provision.Zone) ApplicationId(com.yahoo.config.provision.ApplicationId) Test(org.junit.Test)

Example 30 with Zone

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

the class FilesApplicationPackageTest method testPreprocessing.

@Test
public void testPreprocessing() throws IOException, TransformerException, ParserConfigurationException, SAXException {
    File appDir = temporaryFolder.newFolder();
    IOUtils.copyDirectory(new File("src/test/resources/multienvapp"), appDir);
    assertTrue(new File(appDir, "services.xml").exists());
    assertTrue(new File(appDir, "hosts.xml").exists());
    FilesApplicationPackage app = FilesApplicationPackage.fromFile(appDir);
    ApplicationPackage processed = app.preprocess(new Zone(Environment.dev, RegionName.defaultName()), new BaseDeployLogger());
    assertTrue(new File(appDir, ".preprocessed").exists());
    String expectedServices = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><services xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\" version=\"1.0\">\n" + "    <admin version=\"2.0\">\n" + "        <adminserver hostalias=\"node0\"/>\n" + "    </admin>\n" + "    <content id=\"foo\" version=\"1.0\">\n" + "      <redundancy>1</redundancy>\n" + "      <documents>\n" + "        <document mode=\"index\" type=\"music.sd\"/>\n" + "      </documents>\n" + "      <nodes>\n" + "        <node distribution-key=\"0\" hostalias=\"node0\"/>\n" + "      </nodes>\n" + "    </content>\n" + "    <jdisc id=\"stateless\" version=\"1.0\">\n" + "      <search/>\n" + "      <component bundle=\"foobundle\" class=\"MyFoo\" id=\"foo\"/>\n" + "      <component bundle=\"foobundle\" class=\"TestBar\" id=\"bar\"/>\n" + "      <nodes>\n" + "        <node hostalias=\"node0\" baseport=\"5000\"/>\n" + "      </nodes>\n" + "    </jdisc>\n" + "</services>";
    TestBase.assertDocument(expectedServices, processed.getServices());
    String expectedHosts = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><hosts xmlns:deploy=\"vespa\" xmlns:preprocess=\"properties\">\n" + "    <host name=\"bar.yahoo.com\">\n" + "        <alias>node1</alias>\n" + "    </host>\n" + "</hosts>";
    TestBase.assertDocument(expectedHosts, processed.getHosts());
}
Also used : Zone(com.yahoo.config.provision.Zone) File(java.io.File) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) 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