Skip to content

Commit

Permalink
test: Add application loggers to ApiSystemTest
Browse files Browse the repository at this point in the history
  • Loading branch information
timonback committed Nov 24, 2023
1 parent cbd9d34 commit 95c3a11
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 4 deletions.
3 changes: 3 additions & 0 deletions springwolf-examples/springwolf-amqp-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ dependencies {

testImplementation "org.testcontainers:testcontainers:${testcontainersVersion}"
testImplementation "org.testcontainers:junit-jupiter:${testcontainersVersion}"

testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
}

docker {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.stavshamir.springwolf.example.amqp;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.web.client.RestTemplate;
import org.testcontainers.containers.DockerComposeContainer;
Expand All @@ -22,6 +23,7 @@
* While the assertion of this test is identical to ApiIntegrationTests,
* the setup uses a full docker-compose context with a real kafka instance.
*/
@Slf4j
@Testcontainers
// @Ignore("Uncomment this line if you have issues running this test on your local machine.")
public class ApiSystemTest {
Expand All @@ -45,7 +47,8 @@ public class ApiSystemTest {
@Container
public static DockerComposeContainer<?> environment = new DockerComposeContainer<>(new File("docker-compose.yml"))
.withExposedService(APP_NAME, APP_PORT)
.withEnv(ENV);
.withEnv(ENV)
.withLogConsumer(APP_NAME, l -> log.debug("APP: %s".formatted(l.getUtf8StringWithoutLineEnding())));

private String baseUrl() {
String host = environment.getServiceHost(APP_NAME, APP_PORT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ dependencies {
testImplementation "org.springframework.kafka:spring-kafka-test"
testImplementation "org.testcontainers:testcontainers:${testcontainersVersion}"
testImplementation "org.testcontainers:junit-jupiter:${testcontainersVersion}"

testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
}

docker {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.stavshamir.springwolf.example.cloudstream;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.web.client.RestTemplate;
import org.testcontainers.containers.DockerComposeContainer;
Expand All @@ -22,6 +23,7 @@
* While the assertion of this test is identical to ApiIntegrationTests,
* the setup uses a full docker-compose context with a real kafka instance.
*/
@Slf4j
@Testcontainers
// @Ignore("Uncomment this line if you have issues running this test on your local machine.")
public class ApiSystemTest {
Expand All @@ -45,7 +47,8 @@ public class ApiSystemTest {
@Container
public static DockerComposeContainer<?> environment = new DockerComposeContainer<>(new File("docker-compose.yml"))
.withExposedService(APP_NAME, APP_PORT)
.withEnv(ENV);
.withEnv(ENV)
.withLogConsumer(APP_NAME, l -> log.debug("APP: %s".formatted(l.getUtf8StringWithoutLineEnding())));

private String baseUrl() {
String host = environment.getServiceHost(APP_NAME, APP_PORT);
Expand Down
3 changes: 3 additions & 0 deletions springwolf-examples/springwolf-kafka-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ dependencies {

testImplementation("org.springframework.boot:spring-boot-starter-actuator")
permitTestUnusedDeclared("org.springframework.boot:spring-boot-starter-actuator")

testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
}

docker {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.stavshamir.springwolf.example.kafka;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.web.client.RestTemplate;
import org.testcontainers.containers.DockerComposeContainer;
Expand All @@ -22,6 +23,7 @@
* While the assertion of this test is identical to ApiIntegrationTests,
* the setup uses a full docker-compose context with a real kafka instance.
*/
@Slf4j
@Testcontainers
// @Ignore("Uncomment this line if you have issues running this test on your local machine.")
public class ApiSystemTest {
Expand All @@ -45,7 +47,8 @@ public class ApiSystemTest {
@Container
public static DockerComposeContainer<?> environment = new DockerComposeContainer<>(new File("docker-compose.yml"))
.withExposedService(APP_NAME, APP_PORT)
.withEnv(ENV);
.withEnv(ENV)
.withLogConsumer(APP_NAME, l -> log.debug("APP: %s".formatted(l.getUtf8StringWithoutLineEnding())));

private String baseUrl() {
String host = environment.getServiceHost(APP_NAME, APP_PORT);
Expand Down
3 changes: 3 additions & 0 deletions springwolf-examples/springwolf-sqs-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ dependencies {
testImplementation "org.testcontainers:testcontainers:${testcontainersVersion}"
testImplementation "org.testcontainers:junit-jupiter:${testcontainersVersion}"
testImplementation "org.testcontainers:localstack:${testcontainersVersion}"

testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
}

docker {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
package io.github.stavshamir.springwolf.example.sqs;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.web.client.RestTemplate;
import org.testcontainers.containers.DockerComposeContainer;
Expand All @@ -22,6 +23,7 @@
* While the assertion of this test is identical to ApiIntegrationTests,
* the setup uses a full docker-compose context with a real sqs instance.
*/
@Slf4j
@Testcontainers
// @Ignore("Uncomment this line if you have issues running this test on your local machine.")
public class ApiSystemTest {
Expand All @@ -45,7 +47,8 @@ public class ApiSystemTest {
@Container
public DockerComposeContainer<?> environment = new DockerComposeContainer<>(new File("docker-compose.yml"))
.withExposedService(APP_NAME, APP_PORT)
.withEnv(ENV);
.withEnv(ENV)
.withLogConsumer(APP_NAME, l -> log.debug("APP: %s".formatted(l.getUtf8StringWithoutLineEnding())));

private String baseUrl() {
String host = environment.getServiceHost(APP_NAME, APP_PORT);
Expand Down

0 comments on commit 95c3a11

Please sign in to comment.