Search in sources :

Example 66 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.

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

Example 67 with Zone

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

the class MultigroupProvisioningTest method test_provisioning_of_groups_with_asymmetry.

/**
 * This demonstrates a case where we end up provisioning new nodes rather than reusing retired nodes
 * due to asymmetric group sizes after step 2 (second group has 3 additional retired nodes).
 * We probably need to switch to a multipass group allocation procedure to fix this case.
 */
@Test
@Ignore
public void test_provisioning_of_groups_with_asymmetry() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    ApplicationId application1 = tester.makeApplicationId();
    tester.makeReadyNodes(21, "default");
    deploy(application1, 12, 2, tester);
    deploy(application1, 9, 3, tester);
    deploy(application1, 12, 3, tester);
}
Also used : Zone(com.yahoo.config.provision.Zone) ApplicationId(com.yahoo.config.provision.ApplicationId) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 68 with Zone

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

the class PeriodicApplicationMaintainerTest method before.

@Before
public void before() {
    Curator curator = new MockCurator();
    Zone zone = new Zone(Environment.prod, RegionName.from("us-east"));
    this.nodeRepository = new NodeRepository(nodeFlavors, curator, new ManualClock(), zone, new MockNameResolver().mockAnyLookup(), new DockerImage("docker-registry.domain.tld:8080/dist/vespa"), true);
    this.fixture = new Fixture(zone, nodeRepository, nodeFlavors, curator);
}
Also used : ManualClock(com.yahoo.test.ManualClock) MockNameResolver(com.yahoo.vespa.hosted.provision.testutils.MockNameResolver) Zone(com.yahoo.config.provision.Zone) NodeRepository(com.yahoo.vespa.hosted.provision.NodeRepository) Curator(com.yahoo.vespa.curator.Curator) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) DockerImage(com.yahoo.config.provision.DockerImage) MockCurator(com.yahoo.vespa.curator.mock.MockCurator) Before(org.junit.Before)

Example 69 with Zone

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

the class InactiveAndFailedExpirerTest method reboot_generation_is_increased_when_node_moves_to_dirty.

@Test
public void reboot_generation_is_increased_when_node_moves_to_dirty() {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    List<Node> nodes = tester.makeReadyNodes(2, "default");
    // Allocate and deallocate a single node
    ClusterSpec cluster = ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("test"), Version.fromString("6.42"), false);
    List<HostSpec> preparedNodes = tester.prepare(applicationId, cluster, Capacity.fromNodeCount(2), 1);
    tester.activate(applicationId, new HashSet<>(preparedNodes));
    assertEquals(2, tester.getNodes(applicationId, Node.State.active).size());
    tester.deactivate(applicationId);
    List<Node> inactiveNodes = tester.getNodes(applicationId, Node.State.inactive).asList();
    assertEquals(2, inactiveNodes.size());
    // Check reboot generation before node is moved. New nodes transition from provisioned to dirty, so their
    // wanted reboot generation will always be 1.
    long wantedRebootGeneration = inactiveNodes.get(0).status().reboot().wanted();
    assertEquals(1, wantedRebootGeneration);
    // Inactive times out and node is moved to dirty
    tester.advanceTime(Duration.ofMinutes(14));
    new InactiveExpirer(tester.nodeRepository(), tester.clock(), Duration.ofMinutes(10), new JobControl(tester.nodeRepository().database())).run();
    List<Node> dirty = tester.nodeRepository().getNodes(Node.State.dirty);
    assertEquals(2, dirty.size());
    // Reboot generation is increased
    assertEquals(wantedRebootGeneration + 1, dirty.get(0).status().reboot().wanted());
}
Also used : Zone(com.yahoo.config.provision.Zone) Node(com.yahoo.vespa.hosted.provision.Node) ProvisioningTester(com.yahoo.vespa.hosted.provision.provisioning.ProvisioningTester) ClusterSpec(com.yahoo.config.provision.ClusterSpec) HostSpec(com.yahoo.config.provision.HostSpec) Test(org.junit.Test)

Example 70 with Zone

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

the class InactiveAndFailedExpirerTest method node_that_wants_to_retire_is_moved_to_parked.

@Test
public void node_that_wants_to_retire_is_moved_to_parked() throws OrchestrationException {
    ProvisioningTester tester = new ProvisioningTester(new Zone(Environment.prod, RegionName.from("us-east")));
    ClusterSpec cluster = ClusterSpec.request(ClusterSpec.Type.content, ClusterSpec.Id.from("test"), Version.fromString("6.42"), false);
    tester.makeReadyNodes(5, "default");
    // Allocate two nodes
    {
        List<HostSpec> hostSpecs = tester.prepare(applicationId, cluster, Capacity.fromNodeCount(2), 1);
        tester.activate(applicationId, new HashSet<>(hostSpecs));
        assertEquals(2, tester.getNodes(applicationId, Node.State.active).size());
    }
    // Flag one node for retirement and redeploy
    {
        Node toRetire = tester.getNodes(applicationId, Node.State.active).asList().get(0);
        tester.patchNode(toRetire.with(toRetire.status().withWantToRetire(true)));
        List<HostSpec> hostSpecs = tester.prepare(applicationId, cluster, Capacity.fromNodeCount(2), 1);
        tester.activate(applicationId, new HashSet<>(hostSpecs));
    }
    // Retire times out and one node is moved to inactive
    // Trigger RetiredExpirer
    tester.advanceTime(Duration.ofMinutes(11));
    MockDeployer deployer = new MockDeployer(tester.provisioner(), Collections.singletonMap(applicationId, new MockDeployer.ApplicationContext(applicationId, cluster, Capacity.fromNodeCount(2, Optional.of("default"), false), 1)));
    Orchestrator orchestrator = mock(Orchestrator.class);
    doThrow(new RuntimeException()).when(orchestrator).acquirePermissionToRemove(any());
    new RetiredExpirer(tester.nodeRepository(), tester.orchestrator(), deployer, tester.clock(), Duration.ofDays(30), Duration.ofMinutes(10), new JobControl(tester.nodeRepository().database())).run();
    assertEquals(1, tester.nodeRepository().getNodes(Node.State.inactive).size());
    // Inactive times out and one node is moved to parked
    // Trigger InactiveExpirer
    tester.advanceTime(Duration.ofMinutes(11));
    new InactiveExpirer(tester.nodeRepository(), tester.clock(), Duration.ofMinutes(10), new JobControl(tester.nodeRepository().database())).run();
    assertEquals(1, tester.nodeRepository().getNodes(Node.State.parked).size());
}
Also used : Zone(com.yahoo.config.provision.Zone) Node(com.yahoo.vespa.hosted.provision.Node) ClusterSpec(com.yahoo.config.provision.ClusterSpec) Orchestrator(com.yahoo.vespa.orchestrator.Orchestrator) List(java.util.List) ProvisioningTester(com.yahoo.vespa.hosted.provision.provisioning.ProvisioningTester) MockDeployer(com.yahoo.vespa.hosted.provision.testutils.MockDeployer) HashSet(java.util.HashSet) 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