From 18852338c81eb38cc9cc22ab98a36a771b10fddb Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Tue, 7 Sep 2021 10:29:27 +1000 Subject: [PATCH] Fix continuous testing race Files to watch must be updated before the listeners are notified, otherwise the test may modify the config file before the file set has been updated, and the tests will not be run. --- .../io/quarkus/deployment/dev/testing/JunitTestRunner.java | 7 +++++++ .../java/io/quarkus/deployment/dev/testing/TestRunner.java | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java index f3ebf58184b3c..1c6f5009c660c 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java @@ -73,8 +73,10 @@ import io.quarkus.deployment.QuarkusClassWriter; import io.quarkus.deployment.dev.ClassScanResult; import io.quarkus.deployment.dev.DevModeContext; +import io.quarkus.deployment.dev.RuntimeUpdatesProcessor; import io.quarkus.deployment.util.IoUtil; import io.quarkus.dev.console.QuarkusConsole; +import io.quarkus.dev.testing.TestWatchedFiles; import io.quarkus.dev.testing.TracingHandler; /** @@ -379,6 +381,11 @@ public void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry e QuarkusConsole.INSTANCE.setOutputFilter(null); + //this has to happen before notifying the listeners + Map watched = TestWatchedFiles.retrieveWatchedFilePaths(); + if (watched != null) { + RuntimeUpdatesProcessor.INSTANCE.setWatchedFilePaths(watched, true); + } for (TestRunListener listener : listeners) { listener.runComplete(new TestRunResults(runId, classScanResult, classScanResult == null, start, System.currentTimeMillis(), toResultsMap(testState.getCurrentResults()))); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestRunner.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestRunner.java index 3c057a5422295..cdbe69cf0fdd4 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestRunner.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestRunner.java @@ -24,8 +24,6 @@ import io.quarkus.bootstrap.app.CuratedApplication; import io.quarkus.deployment.dev.ClassScanResult; import io.quarkus.deployment.dev.DevModeContext; -import io.quarkus.deployment.dev.RuntimeUpdatesProcessor; -import io.quarkus.dev.testing.TestWatchedFiles; import io.quarkus.runtime.configuration.HyphenateEnumConverter; public class TestRunner { @@ -254,10 +252,6 @@ public void noTests(TestRunResults results) { synchronized (this) { runner = null; } - Map watched = TestWatchedFiles.retrieveWatchedFilePaths(); - if (watched != null) { - RuntimeUpdatesProcessor.INSTANCE.setWatchedFilePaths(watched, true); - } if (disabled) { return; }