Skip to content

Commit

Permalink
Enable container output logging in tests (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-nenashev authored Dec 11, 2023
1 parent 9b1b9ac commit 3591a54
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
12 changes: 6 additions & 6 deletions test/integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<wiremock-testcontainers.version>1.0-alpha-13</wiremock-testcontainers.version>
<testcontainers.version>1.18.3</testcontainers.version>
<junit.version>5.9.3</junit.version>
<slf4j.version>2.0.7</slf4j.version>
<assertj.version>3.24.2</assertj.version>
<awaitility.version>4.2.0</awaitility.version>
<project.scm.id>github</project.scm.id>
Expand Down Expand Up @@ -54,7 +55,7 @@
<!-- Fix dependency convergence [logback-classic vs junit] -->
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down Expand Up @@ -101,14 +102,13 @@
<artifactId>awaitility</artifactId>
<version>${awaitility.version}</version>
<scope>test</scope>
</dependency> <!--
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.3.7</version>
<scope>provided</scope>
<optional>true</optional>
</dependency> -->
<version>1.4.7</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class TestConfig {
* Docker image tag to be used for testing.
*/
public static String WIREMOCK_IMAGE =
System.getProperty("it.wiremock-image", "wiremock/wiremock:3.1.0-1");
System.getProperty("it.wiremock-image", "wiremock/wiremock:test");

public static String SAMPLES_DIR =
System.getProperty("it.samples-path", "../../samples");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.wiremock.docker.it.extensions;

import org.junit.Before;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -61,6 +62,7 @@ class WireMockContainerExtensionsWebhookTest {
public static String WEBHOOKS_VERSION="3.0.1";

TestHttpServer applicationServer = TestHttpServer.newInstance();
Slf4jLogConsumer logConsumer = new Slf4jLogConsumer(LOGGER);

@Container
WireMockContainer wiremockServer = new WireMockContainer(TestConfig.WIREMOCK_IMAGE)
Expand All @@ -71,6 +73,11 @@ class WireMockContainerExtensionsWebhookTest {
.withExtension("org.wiremock.webhooks.Webhooks")
.withAccessToHost(true); // Force the host access mechanism

@Before
public void setupLogging() {
wiremockServer.followOutput(logConsumer);
}

@Test
void callbackUsingJsonStub() throws Exception {
// given
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<configuration>
<configuration name="WireMock Docker Integration Tests" status="info">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
</encoder>
Expand Down

0 comments on commit 3591a54

Please sign in to comment.