use of com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb in project vespa by vespa-engine.
the class JobControlTest method testJobControlMayDeactivateJobs.
@Test
public void testJobControlMayDeactivateJobs() {
JobControl jobControl = new JobControl(new MockCuratorDb());
ControllerTester tester = new ControllerTester();
MockMaintainer mockMaintainer = new MockMaintainer(tester.controller(), jobControl);
assertTrue(jobControl.jobs().contains("MockMaintainer"));
assertEquals(0, mockMaintainer.maintenanceInvocations);
mockMaintainer.run();
assertEquals(1, mockMaintainer.maintenanceInvocations);
jobControl.setActive("MockMaintainer", false);
mockMaintainer.run();
assertEquals(1, mockMaintainer.maintenanceInvocations);
jobControl.setActive("MockMaintainer", true);
mockMaintainer.run();
assertEquals(2, mockMaintainer.maintenanceInvocations);
}
use of com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb in project vespa by vespa-engine.
the class OutstandingChangeDeployerTest method testChangeDeployer.
@Test
public void testChangeDeployer() {
DeploymentTester tester = new DeploymentTester();
tester.configServer().setDefaultVersion(new Version(6, 1));
OutstandingChangeDeployer deployer = new OutstandingChangeDeployer(tester.controller(), Duration.ofMinutes(10), new JobControl(new MockCuratorDb()));
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("us-west-1").build();
tester.createAndDeploy("app1", 11, applicationPackage);
tester.createAndDeploy("app2", 22, applicationPackage);
Version version = new Version(6, 2);
tester.deploymentTrigger().triggerChange(tester.application("app1").id(), Change.of(version));
tester.deploymentTrigger().triggerReadyJobs();
assertEquals(Change.of(version), tester.application("app1").change());
assertFalse(tester.application("app1").outstandingChange().isPresent());
tester.jobCompletion(DeploymentJobs.JobType.component).application(tester.application("app1")).sourceRevision(new SourceRevision("repository1", "master", "cafed00d")).nextBuildNumber().uploadArtifact(applicationPackage).submit();
Application app = tester.application("app1");
assertTrue(app.outstandingChange().isPresent());
assertEquals("1.0.43-cafed00d", app.outstandingChange().application().get().id());
assertEquals(1, tester.deploymentQueue().jobs().size());
deployer.maintain();
tester.deploymentTrigger().triggerReadyJobs();
assertEquals("No effect as job is in progress", 1, tester.deploymentQueue().jobs().size());
assertEquals("1.0.43-cafed00d", app.outstandingChange().application().get().id());
tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest);
tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest);
tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionUsWest1);
assertEquals("Upgrade done", 0, tester.deploymentQueue().jobs().size());
deployer.maintain();
tester.deploymentTrigger().triggerReadyJobs();
app = tester.application("app1");
assertEquals("1.0.43-cafed00d", app.change().application().get().id());
List<BuildService.BuildJob> jobs = tester.deploymentQueue().jobs();
assertEquals(1, jobs.size());
assertEquals(11, jobs.get(0).projectId());
assertEquals(DeploymentJobs.JobType.systemTest.jobName(), jobs.get(0).jobName());
assertFalse(tester.application("app1").outstandingChange().isPresent());
}
use of com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb in project vespa by vespa-engine.
the class VersionStatusUpdaterTest method testVersionUpdating.
/**
* Test that this job updates the status. Test of the content of the update is in VersionStatusTest
*/
@Test
public void testVersionUpdating() {
ControllerTester tester = new ControllerTester();
tester.controller().updateVersionStatus(new VersionStatus(Collections.emptyList()));
assertFalse(tester.controller().versionStatus().systemVersion().isPresent());
VersionStatusUpdater updater = new VersionStatusUpdater(tester.controller(), Duration.ofMinutes(3), new JobControl(new MockCuratorDb()));
updater.maintain();
assertTrue(tester.controller().versionStatus().systemVersion().isPresent());
}
use of com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb in project vespa by vespa-engine.
the class ApplicationOwnershipConfirmerTest method setup.
@Before
public void setup() {
tester = new DeploymentTester();
issues = new MockOwnershipIssues();
confirmer = new ApplicationOwnershipConfirmer(tester.controller(), Duration.ofDays(1), new JobControl(new MockCuratorDb()), issues);
}
use of com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb in project vespa by vespa-engine.
the class ClusterUtilizationMaintainerTest method maintain.
@Test
public void maintain() {
ControllerTester tester = new ControllerTester();
ApplicationId app = tester.createAndDeploy("tenant1", "domain1", "app1", Environment.dev, 123).id();
// Precondition: no cluster info attached to the deployments
Deployment deployment = tester.controller().applications().get(app).get().deployments().values().stream().findAny().get();
Assert.assertEquals(0, deployment.clusterUtils().size());
ClusterUtilizationMaintainer mainainer = new ClusterUtilizationMaintainer(tester.controller(), Duration.ofHours(1), new JobControl(new MockCuratorDb()));
mainainer.maintain();
deployment = tester.controller().applications().get(app).get().deployments().values().stream().findAny().get();
Assert.assertEquals(1, deployment.clusterUtils().size());
Assert.assertEquals(0.5554, deployment.clusterUtils().get(ClusterSpec.Id.from("default")).getCpu(), Double.MIN_VALUE);
}
Aggregations