Skip to content

Commit b0b7434

Browse files
committed
Ensure logging category is properly set for @QuarkusIntegrationTest
@QuarkusIntegrationTest uses the logging output to determine that the application has properly booted, so we need to make sure that user provided configuration does not turn off the necessary logging output
1 parent dac038e commit b0b7434

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

integration-tests/main/src/main/resources/application.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,7 @@ quarkus.test.enable-callbacks-for-integration-tests=true
6262

6363
# @RolesAllowed value is configuration expression
6464
tester-config-exp=tester
65+
66+
67+
# used to make sure that @QuarkusIntegrationTest works properly when basic logging is turned off
68+
%prod.quarkus.log.category."io.quarkus".level=WARN

integration-tests/picocli-native/src/test/java/io/quarkus/it/picocli/PicocliTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ public void testBasicReflection(LaunchResult result) throws UnknownHostException
3838
public void testMethodSubCommand(QuarkusMainLauncher launcher) {
3939
LaunchResult result = launcher.launch("with-method-sub-command", "hello", "-n", "World!");
4040
assertThat(result.exitCode()).isZero();
41-
assertThat(result.getOutput()).isEqualTo("Hello World!");
41+
assertThat(result.getOutput()).contains("Hello World!");
4242
result = launcher.launch("with-method-sub-command", "goodBye", "-n", "Test?");
4343
assertThat(result.exitCode()).isZero();
44-
assertThat(result.getOutput()).isEqualTo("Goodbye Test?");
44+
assertThat(result.getOutput()).contains("Goodbye Test?");
4545
}
4646

4747
@Test
4848
public void testExcludeLogCapturing(QuarkusMainLauncher launcher) {
4949
org.jboss.logging.Logger.getLogger("test").error("error");
5050
LaunchResult result = launcher.launch("with-method-sub-command", "hello", "-n", "World!");
5151
assertThat(result.exitCode()).isZero();
52-
assertThat(result.getOutput()).isEqualTo("Hello World!");
52+
assertThat(result.getOutput()).contains("Hello World!");
5353
}
5454

5555
@Test
@@ -58,14 +58,13 @@ public void testIncludeLogCommand(QuarkusMainLauncher launcher) {
5858
LaunchResult result = launcher.launch("with-method-sub-command", "loggingHello", "-n", "World!");
5959
assertThat(result.exitCode()).isZero();
6060
assertThat(result.getOutput()).contains("ERROR [io.qua.it.pic.WithMethodSubCommand] (main) Hello World!");
61-
assertThat(result.getOutputStream().size()).isEqualTo(1);
6261
assertThat(result.getOutput()).doesNotContain("ERROR [test] (main) error");
6362
}
6463

6564
@Test
6665
@Launch({ "command-used-as-parent", "-p", "testValue", "child" })
6766
public void testParentCommand(LaunchResult result) {
68-
assertThat(result.getOutput()).isEqualTo("testValue");
67+
assertThat(result.getOutput()).contains("testValue");
6968

7069
assertThat(value).isNotNull();
7170
}
@@ -84,7 +83,7 @@ public void testCommandWithArgGroup(LaunchResult result) {
8483
@Test
8584
@Launch({ "dynamic-proxy" })
8685
public void testDynamicProxy(LaunchResult result) {
87-
assertThat(result.getOutput()).isEqualTo("2007-12-03T10:15:30");
86+
assertThat(result.getOutput()).contains("2007-12-03T10:15:30");
8887

8988
assertThat(value).isNotNull();
9089
}
@@ -128,7 +127,7 @@ public void testCompletionReflection() {
128127
@Test
129128
@Launch("default-value-provider")
130129
public void testDefaultValueProvider(LaunchResult result) {
131-
assertThat(result.getOutput()).isEqualTo("default:default-value");
130+
assertThat(result.getOutput()).contains("default:default-value");
132131

133132
assertThat(value).isNotNull();
134133
}

test-framework/common/src/main/java/io/quarkus/test/common/DefaultDockerContainerLauncher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public void start() throws IOException {
121121
args.add("--net=" + devServicesLaunchResult.networkId());
122122
}
123123

124+
args.addAll(toEnvVar("quarkus.log.category.\"io.quarkus\".level", "INFO"));
124125
if (DefaultJarLauncher.HTTP_PRESENT) {
125126
args.addAll(toEnvVar("quarkus.http.port", "" + httpPort));
126127
args.addAll(toEnvVar("quarkus.http.ssl-port", "" + httpsPort));

test-framework/common/src/main/java/io/quarkus/test/common/DefaultJarLauncher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public void start(String[] programArgs, boolean handleIo) throws IOException {
110110
Path logFile = PropertyTestUtil.getLogFilePath();
111111
args.add("-Dquarkus.log.file.path=" + logFile.toAbsolutePath().toString());
112112
args.add("-Dquarkus.log.file.enable=true");
113+
args.add("-Dquarkus.log.category.\"io.quarkus\".level=INFO");
113114
if (testProfile != null) {
114115
args.add("-Dquarkus.profile=" + testProfile);
115116
}

test-framework/common/src/main/java/io/quarkus/test/common/DefaultNativeImageLauncher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ public void start(String[] programArgs, boolean handleIo) throws IOException {
132132
Path logFile = PropertyTestUtil.getLogFilePath();
133133
args.add("-Dquarkus.log.file.path=" + logFile.toAbsolutePath().toString());
134134
args.add("-Dquarkus.log.file.enable=true");
135+
args.add("-Dquarkus.log.category.\"io.quarkus\".level=INFO");
135136
if (testProfile != null) {
136137
args.add("-Dquarkus.profile=" + testProfile);
137138
}

0 commit comments

Comments
 (0)