Skip to content

Commit

Permalink
Merge pull request quarkusio#18144 from stuartwdouglas/ct-races
Browse files Browse the repository at this point in the history
Fix potential race in continuous testing tests
  • Loading branch information
gsmet authored Jun 28, 2021
2 parents 9ce4a09 + 2792e59 commit a8d7ed6
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ DevConsoleRouteBuildItem handleTestStatus(LaunchModeBuildItem launchModeBuildIte
@Override
public void handle(RoutingContext event) {
jsonResponse(event);
TestSupport.RunStatus status = ts.get().getStatus();
TestSupport testSupport = ts.get();
TestSupport.RunStatus status = testSupport.getStatus();
TestStatus testStatus = new TestStatus();
testStatus.setLastRun(status.getLastRun());
testStatus.setRunning(status.getRunning());
if (status.getLastRun() > 0) {
TestRunResults result = ts.get().getResults();
long lastRun = status.getLastRun();
testStatus.setLastRun(lastRun);
if (lastRun > 0) {
TestRunResults result = testSupport.getResults();
testStatus.setTestsFailed(result.getCurrentFailedCount());
testStatus.setTestsPassed(result.getCurrentPassedCount());
testStatus.setTestsSkipped(result.getCurrentSkippedCount());
Expand All @@ -91,6 +92,9 @@ public void handle(RoutingContext event) {
testStatus.setTotalTestsPassed(result.getPassedCount());
testStatus.setTotalTestsSkipped(result.getSkippedCount());
}
//get running last, as otherwise if the test completes in the meantime you could see
//both running and last run being the same number
testStatus.setRunning(status.getRunning());
event.response().end(JsonObject.mapFrom(testStatus).encode());
}
});
Expand Down

0 comments on commit a8d7ed6

Please sign in to comment.