Skip to content

Commit b271b30

Browse files
committed
chore: testcontainer test changes
1 parent a7793a8 commit b271b30

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

backend/jvm/src/test/kotlin/dev/suresh/AppTests.kt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,24 @@ class AppTests {
117117
val nginx =
118118
GenericContainer(DockerImageName.parse("alpine:latest"))
119119
.withEnv("TLS_CERT_PATH", certDir)
120+
.withCopyToContainer(
121+
Transferable.of(
122+
"""
123+
#!/bin/sh
124+
apk add openssl
125+
mkdir -p $certDir
126+
openssl req -x509 \
127+
-newkey rsa:4096 -sha256 -nodes \
128+
-days 365 \
129+
-subj "/CN=localhost" \
130+
-addext "subjectAltName=DNS:localhost.com,IP:127.0.0.1" \
131+
-keyout $key \
132+
-out $cert
133+
# -outform der -keyform der
134+
"""
135+
.trimIndent(),
136+
365),
137+
"$certDir/gen-certs.sh")
120138
.withCopyToContainer(
121139
Transferable.of(
122140
"""
@@ -129,8 +147,8 @@ class AppTests {
129147
server {
130148
listen 80 default_server;
131149
listen [::]:80 default_server;
132-
listen 443 ssl http2 default_server;
133-
listen [::]:443 ssl http2 default_server;
150+
listen $tlsPort ssl http2 default_server;
151+
listen [::]:$tlsPort ssl http2 default_server;
134152
ssl_certificate $cert;
135153
ssl_certificate_key $key;
136154
location / {
@@ -147,24 +165,6 @@ class AppTests {
147165
.trimIndent(),
148166
365),
149167
"/entrypoint.sh")
150-
.withCopyToContainer(
151-
Transferable.of(
152-
"""
153-
#!/bin/sh
154-
apk add openssl
155-
mkdir -p $certDir
156-
openssl req -x509 \
157-
-newkey rsa:4096 -sha256 -nodes \
158-
-days 365 \
159-
-subj "/CN=localhost" \
160-
-addext "subjectAltName=DNS:localhost.com,IP:127.0.0.1" \
161-
-keyout $key \
162-
-out $cert
163-
# -outform der -keyform der
164-
"""
165-
.trimIndent(),
166-
365),
167-
"$certDir/gen-certs.sh")
168168
.withCommand("sh", "-c", "$certDir/gen-certs.sh && /entrypoint.sh")
169169
.withExposedPorts(tlsPort)
170170
.withLogConsumer(Slf4jLogConsumer(logger, false))

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ expiringmap = "0.5.10"
125125
otp = "2.0.3"
126126
password4j = "1.8.2"
127127
apache-commons-imaging = "1.0-alpha3"
128-
testcontainers = "1.20.0"
128+
testcontainers = "1.20.1"
129129
sourceBuddy = "2.5.0"
130130
tcp-javanioproxy = "1.6"
131131
konsist = "0.15.1"

0 commit comments

Comments
 (0)