Skip to content

Commit 289a2cd

Browse files
authored
test(e2e): improve testing for error logs (#889)
1 parent 9034919 commit 289a2cd

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

springwolf-examples/e2e/util/external_process.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ export function verifyNoErrorLogs(dockerLogs: MonitorDockerLogsResponse) {
5454

5555
const errorMessages = dockerLogs.messages
5656
.filter((message) => message.includes("i.g.s")) // io.github.springwolf
57-
.filter((message) => message.includes("ERROR") || message.includes("WARN"));
57+
.filter(
58+
(message) =>
59+
message.includes("ERROR") ||
60+
message.includes("WARN") ||
61+
message.includes("Failed")
62+
);
5863

5964
expect(errorMessages, {
6065
message: "expect: No Springwolf ERROR or WARN log messages found",

springwolf-examples/springwolf-jms-example/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ dependencies {
4848

4949
testImplementation "org.testcontainers:testcontainers:${testcontainersVersion}"
5050
testImplementation "org.testcontainers:junit-jupiter:${testcontainersVersion}"
51+
52+
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
53+
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
5154
}
5255

5356
docker {

springwolf-examples/springwolf-jms-example/src/test/java/io/github/springwolf/examples/jms/ApiSystemTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: Apache-2.0
22
package io.github.springwolf.examples.jms;
33

4+
import lombok.extern.slf4j.Slf4j;
45
import org.junit.jupiter.api.Test;
56
import org.springframework.web.client.RestTemplate;
67
import org.testcontainers.containers.DockerComposeContainer;
@@ -23,6 +24,7 @@
2324
* the setup uses a full docker-compose context with a real jms instance.
2425
*/
2526
@Testcontainers
27+
@Slf4j
2628
// @Ignore("Uncomment this line if you have issues running this test on your local machine.")
2729
public class ApiSystemTest {
2830

@@ -43,9 +45,10 @@ public class ApiSystemTest {
4345
}
4446

4547
@Container
46-
public DockerComposeContainer<?> environment = new DockerComposeContainer<>(new File("docker-compose.yml"))
48+
public static DockerComposeContainer<?> environment = new DockerComposeContainer<>(new File("docker-compose.yml"))
4749
.withExposedService(APP_NAME, APP_PORT)
48-
.withEnv(ENV);
50+
.withEnv(ENV)
51+
.withLogConsumer(APP_NAME, l -> log.debug("APP: {}", l.getUtf8StringWithoutLineEnding()));
4952

5053
private String baseUrl() {
5154
String host = environment.getServiceHost(APP_NAME, APP_PORT);

0 commit comments

Comments
 (0)