Skip to content

Commit

Permalink
Re #123: Fixed nginx testcontainers startup condition.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkowalcz committed Jul 25, 2024
1 parent 0f93e9f commit 00e5a74
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.NginxContainer;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import pl.tkowalcz.tjahzi.log4j2.infra.IntegrationTest;
import pl.tkowalcz.tjahzi.log4j2.infra.LokiAssert;
Expand All @@ -16,7 +16,7 @@
class LokiAppenderHttpsCustomEndpointTest extends IntegrationTest {

@Container
public NginxContainer<?> nginx = new NginxContainer<>("nginx:latest")
public NginxContainer<?> nginx = new NginxContainer<>("nginx:1.25")
.withNetwork(network)
.withClasspathResourceMapping("loki.reverse.nginx.conf",
"/etc/nginx/conf.d/loki.reverse.conf",
Expand All @@ -34,7 +34,11 @@ class LokiAppenderHttpsCustomEndpointTest extends IntegrationTest {
"/etc/nginx/passwords",
BindMode.READ_ONLY
)
.waitingFor(new HttpWaitStrategy())
.waitingFor(Wait
.forHttp("/")
.forStatusCode(200)
.forStatusCode(400)
)
.withExposedPorts(81);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.NginxContainer;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import pl.tkowalcz.tjahzi.log4j2.infra.IntegrationTest;
import pl.tkowalcz.tjahzi.log4j2.infra.LokiAssert;
Expand All @@ -16,7 +16,7 @@
class LokiAppenderHttpsUrlConnectionReverseProxyTest extends IntegrationTest {

@Container
public NginxContainer<?> nginx = new NginxContainer<>("nginx:latest")
public NginxContainer<?> nginx = new NginxContainer<>("nginx:1.25")
.withNetwork(network)
.withClasspathResourceMapping("loki.reverse.nginx.conf",
"/etc/nginx/conf.d/loki.reverse.conf",
Expand All @@ -34,7 +34,11 @@ class LokiAppenderHttpsUrlConnectionReverseProxyTest extends IntegrationTest {
"/etc/nginx/passwords",
BindMode.READ_ONLY
)
.waitingFor(new HttpWaitStrategy())
.waitingFor(Wait
.forHttp("/")
.forStatusCode(200)
.forStatusCode(400)
)
.withExposedPorts(81);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.slf4j.Logger;
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.NginxContainer;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import pl.tkowalcz.tjahzi.logback.infra.IntegrationTest;

Expand All @@ -16,7 +16,7 @@
class LokiAppenderHttpsCustomEndpointTest extends IntegrationTest {

@Container
public NginxContainer<?> nginx = new NginxContainer<>("nginx:latest")
public NginxContainer<?> nginx = new NginxContainer<>("nginx:1.25")
.withNetwork(network)
.withClasspathResourceMapping("loki.reverse.nginx.conf",
"/etc/nginx/conf.d/loki.reverse.conf",
Expand All @@ -34,7 +34,11 @@ class LokiAppenderHttpsCustomEndpointTest extends IntegrationTest {
"/etc/nginx/passwords",
BindMode.READ_ONLY
)
.waitingFor(new HttpWaitStrategy())
.waitingFor(Wait
.forHttp("/")
.forStatusCode(200)
.forStatusCode(400)
)
.withExposedPorts(81);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.slf4j.Logger;
import org.testcontainers.containers.BindMode;
import org.testcontainers.containers.NginxContainer;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import pl.tkowalcz.tjahzi.logback.infra.IntegrationTest;

Expand All @@ -16,7 +16,7 @@
class LokiAppenderHttpsUrlConnectionReverseProxyTest extends IntegrationTest {

@Container
public NginxContainer<?> nginx = new NginxContainer<>("nginx:latest")
public NginxContainer<?> nginx = new NginxContainer<>("nginx:1.25")
.withNetwork(network)
.withClasspathResourceMapping("loki.reverse.nginx.conf",
"/etc/nginx/conf.d/loki.reverse.conf",
Expand All @@ -34,7 +34,11 @@ class LokiAppenderHttpsUrlConnectionReverseProxyTest extends IntegrationTest {
"/etc/nginx/passwords",
BindMode.READ_ONLY
)
.waitingFor(new HttpWaitStrategy())
.waitingFor(Wait
.forHttp("/")
.forStatusCode(200)
.forStatusCode(400)
)
.withExposedPorts(81);

@Override
Expand Down

0 comments on commit 00e5a74

Please sign in to comment.