From 09fc60bdcd7c5eb5eab72bee734174a4bf575a47 Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Mon, 10 Sep 2018 09:10:26 +0200 Subject: Make assertions before other threads may have violated them --- .../com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'controller-server') diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java index a77f0789314..0b2863dab1d 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java @@ -75,7 +75,6 @@ public class JobRunnerTest { public void multiThreadedExecutionFinishes() throws InterruptedException { DeploymentTester tester = new DeploymentTester(); JobController jobs = tester.controller().jobController(); - // Fail the installation of the initial version of the real application in staging tests, and succeed everything else. StepRunner stepRunner = (step, id) -> id.type() == stagingTest && step.get() == startTests? Optional.of(error) : Optional.of(running); CountDownLatch latch = new CountDownLatch(19); // Number of steps that will run, below: all but endTests in staging and all 9 in system. JobRunner runner = new JobRunner(tester.controller(), Duration.ofDays(1), new JobControl(tester.controller().curator()), @@ -93,9 +92,10 @@ public class JobRunnerTest { jobs.start(id, stagingTest, versions); assertTrue(jobs.last(id, systemTest).get().steps().values().stream().allMatch(unfinished::equals)); - runner.maintain(); assertFalse(jobs.last(id, systemTest).get().hasEnded()); + assertTrue(jobs.last(id, stagingTest).get().steps().values().stream().allMatch(unfinished::equals)); assertFalse(jobs.last(id, stagingTest).get().hasEnded()); + runner.maintain(); latch.await(1, TimeUnit.SECONDS); assertEquals(0, latch.getCount()); -- cgit v1.2.3