Skip to content

Commit c72b623

Browse files
Merge branch 'testcontainers:main' into expose-grpc-endpoint
2 parents 16b5244 + 4eca3bd commit c72b623

File tree

99 files changed

+1459
-1295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1459
-1295
lines changed

core/src/main/java/org/testcontainers/utility/RyukContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class RyukContainer extends GenericContainer<RyukContainer> {
1010

1111
RyukContainer() {
12-
super("testcontainers/ryuk:0.12.0");
12+
super("testcontainers/ryuk:0.13.0");
1313
withExposedPorts(8080);
1414
withCreateContainerCmdModifier(cmd -> {
1515
cmd.withName("testcontainers-ryuk-" + DockerClientFactory.SESSION_ID);

modules/chromadb/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ description = "Testcontainers :: ChromaDB"
33
dependencies {
44
api project(':testcontainers')
55

6+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'
7+
68
testImplementation 'org.assertj:assertj-core:3.27.4'
9+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
710
testImplementation 'io.rest-assured:rest-assured:5.5.6'
811
}
12+
13+
test {
14+
useJUnitPlatform()
15+
}

modules/chromadb/src/test/java/org/testcontainers/chromadb/ChromaDBContainerTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package org.testcontainers.chromadb;
22

33
import io.restassured.http.ContentType;
4-
import org.junit.Test;
4+
import org.junit.jupiter.api.Test;
55

66
import static io.restassured.RestAssured.given;
77

8-
public class ChromaDBContainerTest {
8+
class ChromaDBContainerTest {
99

1010
@Test
11-
public void test() {
11+
void test() {
1212
try ( // container {
1313
ChromaDBContainer chroma = new ChromaDBContainer("chromadb/chroma:0.4.23")
1414
// }
@@ -29,7 +29,7 @@ public void test() {
2929
}
3030

3131
@Test
32-
public void testVersion2() {
32+
void testVersion2() {
3333
try (ChromaDBContainer chroma = new ChromaDBContainer("chromadb/chroma:1.0.0")) {
3434
chroma.start();
3535

modules/consul/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ description = "Testcontainers :: Consul"
33
dependencies {
44
api project(':testcontainers')
55

6+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'
7+
8+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
69
testImplementation 'com.ecwid.consul:consul-api:1.4.5'
710
testImplementation 'io.rest-assured:rest-assured:5.5.6'
811
testImplementation 'org.assertj:assertj-core:3.27.4'
912
}
13+
14+
test {
15+
useJUnitPlatform()
16+
}

modules/consul/src/test/java/org/testcontainers/consul/ConsulContainerTest.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import com.ecwid.consul.v1.Response;
55
import com.ecwid.consul.v1.kv.model.GetValue;
66
import io.restassured.RestAssured;
7-
import org.junit.ClassRule;
8-
import org.junit.Test;
7+
import org.junit.jupiter.api.AfterAll;
8+
import org.junit.jupiter.api.BeforeAll;
9+
import org.junit.jupiter.api.Test;
910
import org.testcontainers.containers.GenericContainer;
1011

1112
import java.io.IOException;
@@ -16,25 +17,30 @@
1617

1718
import static org.assertj.core.api.Assertions.assertThat;
1819

19-
/**
20-
* This test shows the pattern to use the ConsulContainer @ClassRule for a junit test. It also has tests that ensure
21-
* the properties were added correctly by reading from Consul with the CLI and over HTTP.
22-
*/
23-
public class ConsulContainerTest {
20+
class ConsulContainerTest {
2421

25-
@ClassRule
26-
public static ConsulContainer consulContainer = new ConsulContainer("hashicorp/consul:1.15")
22+
private static ConsulContainer consul = new ConsulContainer("hashicorp/consul:1.15")
2723
.withConsulCommand("kv put config/testing1 value123");
2824

25+
@BeforeAll
26+
static void setup() {
27+
consul.start();
28+
}
29+
30+
@AfterAll
31+
static void teardown() {
32+
consul.stop();
33+
}
34+
2935
@Test
30-
public void readFirstPropertyPathWithCli() throws IOException, InterruptedException {
31-
GenericContainer.ExecResult result = consulContainer.execInContainer("consul", "kv", "get", "config/testing1");
36+
void readFirstPropertyPathWithCli() throws IOException, InterruptedException {
37+
GenericContainer.ExecResult result = consul.execInContainer("consul", "kv", "get", "config/testing1");
3238
final String output = result.getStdout().replaceAll("\\r?\\n", "");
3339
assertThat(output).contains("value123");
3440
}
3541

3642
@Test
37-
public void readFirstSecretPathOverHttpApi() {
43+
void readFirstSecretPathOverHttpApi() {
3844
io.restassured.response.Response response = RestAssured
3945
.given()
4046
.when()
@@ -46,11 +52,8 @@ public void readFirstSecretPathOverHttpApi() {
4652
}
4753

4854
@Test
49-
public void writeAndReadMultipleValuesUsingClient() {
50-
final ConsulClient consulClient = new ConsulClient(
51-
consulContainer.getHost(),
52-
consulContainer.getFirstMappedPort()
53-
);
55+
void writeAndReadMultipleValuesUsingClient() {
56+
final ConsulClient consulClient = new ConsulClient(consul.getHost(), consul.getFirstMappedPort());
5457

5558
final Map<String, String> properties = new HashMap<>();
5659
properties.put("value", "world");
@@ -70,6 +73,6 @@ public void writeAndReadMultipleValuesUsingClient() {
7073
}
7174

7275
private String getHostAndPort() {
73-
return consulContainer.getHost() + ":" + consulContainer.getMappedPort(8500);
76+
return consul.getHost() + ":" + consul.getMappedPort(8500);
7477
}
7578
}

modules/couchbase/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ dependencies {
55
// TODO use JDK's HTTP client and/or Apache HttpClient5
66
shaded 'com.squareup.okhttp3:okhttp:5.1.0'
77

8+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'
9+
10+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
811
testImplementation 'com.couchbase.client:java-client:3.9.0'
912
testImplementation 'org.awaitility:awaitility:4.3.0'
1013
testImplementation 'org.assertj:assertj-core:3.27.4'
@@ -15,3 +18,7 @@ tasks.japicmp {
1518
"org.testcontainers.couchbase.CouchbaseContainer"
1619
]
1720
}
21+
22+
test {
23+
useJUnitPlatform()
24+
}

modules/couchbase/src/test/java/org/testcontainers/couchbase/CouchbaseContainerTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import com.couchbase.client.java.Cluster;
2121
import com.couchbase.client.java.Collection;
2222
import com.couchbase.client.java.json.JsonObject;
23-
import org.junit.Test;
23+
import org.junit.jupiter.api.Test;
2424
import org.testcontainers.containers.ContainerLaunchException;
2525

2626
import java.time.Duration;
@@ -30,7 +30,7 @@
3030
import static org.assertj.core.api.Assertions.assertThatThrownBy;
3131
import static org.awaitility.Awaitility.await;
3232

33-
public class CouchbaseContainerTest {
33+
class CouchbaseContainerTest {
3434

3535
private static final String COUCHBASE_IMAGE_ENTERPRISE = "couchbase/server:enterprise-7.0.3";
3636

@@ -41,22 +41,22 @@ public class CouchbaseContainerTest {
4141
private static final String COUCHBASE_IMAGE_COMMUNITY_RECENT = "couchbase/server:community-7.6.2";
4242

4343
@Test
44-
public void testBasicContainerUsageForEnterpriseContainer() {
44+
void testBasicContainerUsageForEnterpriseContainer() {
4545
testBasicContainerUsage(COUCHBASE_IMAGE_ENTERPRISE);
4646
}
4747

4848
@Test
49-
public void testBasicContainerUsageForEnterpriseContainerRecent() {
49+
void testBasicContainerUsageForEnterpriseContainerRecent() {
5050
testBasicContainerUsage(COUCHBASE_IMAGE_ENTERPRISE_RECENT);
5151
}
5252

5353
@Test
54-
public void testBasicContainerUsageForCommunityContainer() {
54+
void testBasicContainerUsageForCommunityContainer() {
5555
testBasicContainerUsage(COUCHBASE_IMAGE_COMMUNITY);
5656
}
5757

5858
@Test
59-
public void testBasicContainerUsageForCommunityContainerRecent() {
59+
void testBasicContainerUsageForCommunityContainerRecent() {
6060
testBasicContainerUsage(COUCHBASE_IMAGE_COMMUNITY_RECENT);
6161
}
6262

@@ -89,7 +89,7 @@ private void testBasicContainerUsage(String couchbaseImage) {
8989
}
9090

9191
@Test
92-
public void testBucketIsFlushableIfEnabled() {
92+
void testBucketIsFlushableIfEnabled() {
9393
BucketDefinition bucketDefinition = new BucketDefinition("mybucket").withFlushEnabled(true);
9494

9595
try (
@@ -119,7 +119,7 @@ public void testBucketIsFlushableIfEnabled() {
119119
* edition which is not supported.
120120
*/
121121
@Test
122-
public void testFailureIfCommunityUsedWithAnalytics() {
122+
void testFailureIfCommunityUsedWithAnalytics() {
123123
try (
124124
CouchbaseContainer container = new CouchbaseContainer(COUCHBASE_IMAGE_COMMUNITY)
125125
.withEnabledServices(CouchbaseService.KV, CouchbaseService.ANALYTICS)
@@ -136,7 +136,7 @@ public void testFailureIfCommunityUsedWithAnalytics() {
136136
* edition which is not supported.
137137
*/
138138
@Test
139-
public void testFailureIfCommunityUsedWithEventing() {
139+
void testFailureIfCommunityUsedWithEventing() {
140140
try (
141141
CouchbaseContainer container = new CouchbaseContainer(COUCHBASE_IMAGE_COMMUNITY)
142142
.withEnabledServices(CouchbaseService.KV, CouchbaseService.EVENTING)

modules/database-commons/build.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,12 @@ description = "Testcontainers :: Database-Commons"
33
dependencies {
44
api project(':testcontainers')
55

6+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'
7+
8+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.4'
69
testImplementation 'org.assertj:assertj-core:3.27.4'
710
}
11+
12+
test {
13+
useJUnitPlatform()
14+
}

modules/database-commons/src/test/java/org/testcontainers/ext/ScriptScannerTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
package org.testcontainers.ext;
22

33
import org.apache.commons.lang3.StringUtils;
4-
import org.junit.Test;
4+
import org.junit.jupiter.api.Test;
55

66
import java.util.regex.Pattern;
77

88
import static org.assertj.core.api.Assertions.assertThat;
99

10-
public class ScriptScannerTest {
10+
class ScriptScannerTest {
1111

1212
@Test
13-
public void testHugeStringLiteral() {
13+
void testHugeStringLiteral() {
1414
String script = "/* a comment */ \"" + StringUtils.repeat('~', 10000) + "\";";
1515
ScriptScanner scanner = scanner(script);
1616
assertThat(scanner.next()).isEqualTo(ScriptScanner.Lexem.COMMENT);
@@ -20,7 +20,7 @@ public void testHugeStringLiteral() {
2020
}
2121

2222
@Test
23-
public void testPgIdentifierWithDollarSigns() {
23+
void testPgIdentifierWithDollarSigns() {
2424
ScriptScanner scanner = scanner(
2525
"this$is$a$valid$postgreSQL$identifier " +
2626
"$a$While this is a quoted string$a$$ --just followed by a dollar sign"
@@ -32,7 +32,7 @@ public void testPgIdentifierWithDollarSigns() {
3232
}
3333

3434
@Test
35-
public void testQuotedLiterals() {
35+
void testQuotedLiterals() {
3636
ScriptScanner scanner = scanner("'this \\'is a literal' \"this \\\" is a literal\"");
3737
assertThat(scanner.next()).isEqualTo(ScriptScanner.Lexem.QUOTED_STRING);
3838
assertThat(scanner.getCurrentMatch()).isEqualTo("'this \\'is a literal'");

0 commit comments

Comments
 (0)