Search in sources :

Example 21 with Deployment

use of com.yahoo.vespa.hosted.controller.application.Deployment in project vespa by vespa-engine.

the class DeploymentMetricsMaintainerTest method maintain.

@Test
public void maintain() {
    ControllerTester tester = new ControllerTester();
    ApplicationId app = tester.createAndDeploy("tenant1", "domain1", "app1", Environment.dev, 123).id();
    // Pre condition: no metric info on neither application nor deployment
    assertEquals(0, tester.controller().applications().require(app).metrics().queryServiceQuality(), 0);
    Deployment deployment = tester.controller().applications().get(app).get().deployments().values().stream().findAny().get();
    assertEquals(0, deployment.metrics().documentCount(), 0);
    DeploymentMetricsMaintainer maintainer = new DeploymentMetricsMaintainer(tester.controller(), Duration.ofMinutes(10), new JobControl(new MockCuratorDb()));
    maintainer.maintain();
    // Post condition:
    Application application = tester.controller().applications().require(app);
    assertEquals(0.5, application.metrics().queryServiceQuality(), Double.MIN_VALUE);
    assertEquals(0.7, application.metrics().writeServiceQuality(), Double.MIN_VALUE);
    deployment = application.deployments().values().stream().findAny().get();
    assertEquals(1, deployment.metrics().queriesPerSecond(), Double.MIN_VALUE);
    assertEquals(2, deployment.metrics().writesPerSecond(), Double.MIN_VALUE);
    assertEquals(3, deployment.metrics().documentCount(), Double.MIN_VALUE);
    assertEquals(4, deployment.metrics().queryLatencyMillis(), Double.MIN_VALUE);
    assertEquals(5, deployment.metrics().writeLatencyMillis(), Double.MIN_VALUE);
}
Also used : MockCuratorDb(com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment) ApplicationId(com.yahoo.config.provision.ApplicationId) Application(com.yahoo.vespa.hosted.controller.Application) ControllerTester(com.yahoo.vespa.hosted.controller.ControllerTester) Test(org.junit.Test)

Aggregations

Deployment (com.yahoo.vespa.hosted.controller.application.Deployment)21 Application (com.yahoo.vespa.hosted.controller.Application)15 ApplicationId (com.yahoo.config.provision.ApplicationId)12 Version (com.yahoo.component.Version)9 ZoneId (com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId)9 ApplicationVersion (com.yahoo.vespa.hosted.controller.application.ApplicationVersion)7 DeploymentSpec (com.yahoo.config.application.api.DeploymentSpec)6 DeploymentId (com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId)6 ApplicationPackage (com.yahoo.vespa.hosted.controller.application.ApplicationPackage)6 DeploymentJobs (com.yahoo.vespa.hosted.controller.application.DeploymentJobs)6 Collections (java.util.Collections)6 List (java.util.List)6 Optional (java.util.Optional)6 ControllerTester (com.yahoo.vespa.hosted.controller.ControllerTester)5 DeploymentMetrics (com.yahoo.vespa.hosted.controller.application.DeploymentMetrics)5 URI (java.net.URI)5 ArrayList (java.util.ArrayList)5 Environment (com.yahoo.config.provision.Environment)4 TenantName (com.yahoo.config.provision.TenantName)4 JobStatus (com.yahoo.vespa.hosted.controller.application.JobStatus)4