From 5bf730e6d4feb7b8e0c6cb29e86693d9b144d608 Mon Sep 17 00:00:00 2001 From: Jose Date: Fri, 23 Apr 2021 10:59:05 +0200 Subject: [PATCH] Ignore SLFJ4 warnings in Windows --- .../io/quarkus/ts/startstop/utils/Logs.java | 21 ++++++++++++------- .../ts/startstop/utils/WhitelistLogLines.java | 4 ++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/testsuite/src/it/java/io/quarkus/ts/startstop/utils/Logs.java b/testsuite/src/it/java/io/quarkus/ts/startstop/utils/Logs.java index 6eeaa99f..e6c35c6f 100644 --- a/testsuite/src/it/java/io/quarkus/ts/startstop/utils/Logs.java +++ b/testsuite/src/it/java/io/quarkus/ts/startstop/utils/Logs.java @@ -96,13 +96,20 @@ public static void checkLog(String testClass, String testMethod, Apps app, MvnCm } } - // Quarkus is not being gratefully shutdown in Windows when running in Dev mode. - // Reported by https://github.com/quarkusio/quarkus/issues/14647. - if (Commands.isThisWindows && isDevModeError(offendingLines)) { - for (Pattern windowsDevModeErrorToIgnore : WhitelistLogLines.WINDOWS_DEV_MODE_ERRORS.errs) { - offendingLines.removeIf(line -> windowsDevModeErrorToIgnore.matcher(line).matches()); - } - } + if (Commands.isThisWindows) { + + List ignoredErrs = new ArrayList<>(Arrays.asList(WhitelistLogLines.WINDOWS_ERRORS.errs)); + + if (isDevModeError(offendingLines)) { + // Quarkus is not being gratefully shutdown in Windows when running in Dev mode. + // Reported by https://github.com/quarkusio/quarkus/issues/14647. + ignoredErrs.addAll(Arrays.asList(WhitelistLogLines.WINDOWS_DEV_MODE_ERRORS.errs)); + } + + for (Pattern windowsDevModeErrorToIgnore : ignoredErrs) { + offendingLines.removeIf(line -> windowsDevModeErrorToIgnore.matcher(line).matches()); + } + } assertTrue(offendingLines.isEmpty(), cmd.name() + " log should not contain error or warning lines that are not whitelisted. " + diff --git a/testsuite/src/it/java/io/quarkus/ts/startstop/utils/WhitelistLogLines.java b/testsuite/src/it/java/io/quarkus/ts/startstop/utils/WhitelistLogLines.java index 8ceb1a8a..2682acba 100755 --- a/testsuite/src/it/java/io/quarkus/ts/startstop/utils/WhitelistLogLines.java +++ b/testsuite/src/it/java/io/quarkus/ts/startstop/utils/WhitelistLogLines.java @@ -78,6 +78,10 @@ public enum WhitelistLogLines { // Result of DevServices support https://github.com/quarkusio/quarkus/pull/14960 Pattern.compile(".*Unable to determine a database type for default datasource.*"), }), + WINDOWS_ERRORS(new Pattern[] { + // When running on Windows, some warning SLF4J traces are randomly printed + Pattern.compile(".*SLF4J: .*") + }), WINDOWS_DEV_MODE_ERRORS(new Pattern[]{ Pattern.compile(".*Re-run Maven using the -X switch to enable full debug logging.*"), Pattern.compile(".*For more information about the errors and possible solutions, please read the following articles.*"),