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);
}
Aggregations