Skip to content

Commit 6c4f7ea

Browse files
authored
Merge branch 'main' into typos
2 parents f7e6125 + df40cd8 commit 6c4f7ea

File tree

48 files changed

+2387
-40
lines changed

Some content is hidden

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

48 files changed

+2387
-40
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ body:
5050
- Oracle Free
5151
- Oracle XE
5252
- OrientDB
53+
- Pinecone
5354
- PostgreSQL
5455
- Presto
5556
- Pulsar
5657
- Qdrant
5758
- QuestDB
5859
- RabbitMQ
5960
- Redpanda
61+
- ScyllaDB
6062
- Selenium
6163
- Solace
6264
- Solr

.github/ISSUE_TEMPLATE/enhancement.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ body:
5050
- Oracle Free
5151
- Oracle XE
5252
- OrientDB
53+
- Pinecone
5354
- PostgreSQL
5455
- Presto
5556
- Pulsar
5657
- Qdrant
5758
- QuestDB
5859
- RabbitMQ
5960
- Redpanda
61+
- ScyllaDB
6062
- Selenium
6163
- Solace
6264
- Solr

.github/ISSUE_TEMPLATE/feature.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ body:
5050
- Oracle Free
5151
- Oracle XE
5252
- OrientDB
53+
- Pinecone
5354
- PostgreSQL
5455
- Qdrant
5556
- QuestDB
5657
- Presto
5758
- Pulsar
5859
- RabbitMQ
5960
- Redpanda
61+
- ScyllaDB
6062
- Selenium
6163
- Solace
6264
- Solr

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ updates:
274274
schedule:
275275
interval: "weekly"
276276
open-pull-requests-limit: 10
277+
- package-ecosystem: "gradle"
278+
directory: "/modules/pinecone"
279+
schedule:
280+
interval: "weekly"
281+
open-pull-requests-limit: 10
277282
- package-ecosystem: "gradle"
278283
directory: "/modules/pulsar"
279284
schedule:
@@ -310,6 +315,11 @@ updates:
310315
schedule:
311316
interval: "weekly"
312317
open-pull-requests-limit: 10
318+
- package-ecosystem: "gradle"
319+
directory: "/modules/scylladb"
320+
schedule:
321+
interval: "weekly"
322+
open-pull-requests-limit: 10
313323
- package-ecosystem: "gradle"
314324
directory: "/modules/selenium"
315325
schedule:

.github/labeler.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@
168168
- changed-files:
169169
- any-glob-to-any-file:
170170
- modules/orientdb/**/*
171+
"modules/pinecone":
172+
- changed-files:
173+
- any-glob-to-any-file:
174+
- modules/pinecone/**/*
171175
"modules/postgres":
172176
- changed-files:
173177
- any-glob-to-any-file:
@@ -200,6 +204,10 @@
200204
- changed-files:
201205
- any-glob-to-any-file:
202206
- modules/redpanda/**/*
207+
"modules/scylladb":
208+
- changed-files:
209+
- any-glob-to-any-file:
210+
- modules/scylladb/**/*
203211
"modules/selenium":
204212
- changed-files:
205213
- any-glob-to-any-file:

.github/settings.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ labels:
211211
- name: modules/orientdb
212212
color: '#006b75'
213213

214+
- name: modules/pinecone
215+
color: '#006b75'
216+
214217
- name: modules/postgres
215218
color: '#006b75'
216219

docs/modules/azure.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ This module is INCUBATING. While it is ready for use and operational in the curr
55

66
Testcontainers module for the Microsoft Azure's [SDK](https://github.com/Azure/azure-sdk-for-java).
77

8-
Currently, the module supports `Azurite` and `CosmosDB` emulators. In order to use them, you should use the following classes:
8+
Currently, the module supports `Azurite`, `Azure Event Hubs`, `Azure Service Bus` and `CosmosDB` emulators. In order to use them, you should use the following classes:
99

1010
Class | Container Image
1111
-|-
1212
AzuriteContainer | [mcr.microsoft.com/azure-storage/azurite](https://github.com/microsoft/containerregistry)
13+
AzureEventHubsContainer | [mcr.microsoft.com/azure-messaging/eventhubs-emulator](https://github.com/microsoft/containerregistry)
14+
AzureServiceBusEmulatorContainer | [mcr.microsoft.com/azure-messaging/servicebus-emulator](https://github.com/microsoft/containerregistry)
15+
AzureServiceBusContainer | [mcr.microsoft.com/azure-messaging/servicebus-emulator](https://github.com/microsoft/containerregistry)
1316
CosmosDBEmulatorContainer | [mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator](https://github.com/microsoft/containerregistry)
1417

1518
## Usage example
@@ -72,6 +75,66 @@ Build Azure Table client:
7275
!!! note
7376
We can use custom credentials the same way as defined in the Blob section.
7477

78+
### Azure Event Hubs Emulator
79+
80+
<!--codeinclude-->
81+
[Configuring the Azure Event Hubs Emulator container](../../modules/azure/src/test/resources/eventhubs_config.json)
82+
<!--/codeinclude-->
83+
84+
Start Azure Event Hubs Emulator during a test:
85+
86+
<!--codeinclude-->
87+
[Setting up a network](../../modules/azure/src/test/java/org/testcontainers/azure/AzureEventHubsContainerTest.java) inside_block:network
88+
<!--/codeinclude-->
89+
90+
<!--codeinclude-->
91+
[Starting an Azurite container as dependency](../../modules/azure/src/test/java/org/testcontainers/azure/AzureEventHubsContainerTest.java) inside_block:azuriteContainer
92+
<!--/codeinclude-->
93+
94+
<!--codeinclude-->
95+
[Starting an Azure Event Hubs Emulator container](../../modules/azure/src/test/java/org/testcontainers/azure/AzureEventHubsContainerTest.java) inside_block:emulatorContainer
96+
<!--/codeinclude-->
97+
98+
#### Using Azure Event Hubs clients
99+
100+
Configure the consumer and the producer clients:
101+
102+
<!--codeinclude-->
103+
[Configuring the clients](../../modules/azure/src/test/java/org/testcontainers/azure/AzureEventHubsContainerTest.java) inside_block:createProducerAndConsumer
104+
<!--/codeinclude-->
105+
106+
### Azure Service Bus Emulator
107+
108+
<!--codeinclude-->
109+
[Configuring the Azure Service Bus Emulator container](../../modules/azure/src/test/resources/service-bus-config.json)
110+
<!--/codeinclude-->
111+
112+
Start Azure Service Bus Emulator during a test:
113+
114+
<!--codeinclude-->
115+
[Setting up a network](../../modules/azure/src/test/java/org/testcontainers/azure/AzureServiceBusContainerTest.java) inside_block:network
116+
<!--/codeinclude-->
117+
118+
<!--codeinclude-->
119+
[Starting a SQL Server container as dependency](../../modules/azure/src/test/java/org/testcontainers/azure/AzureServiceBusContainerTest.java) inside_block:sqlContainer
120+
<!--/codeinclude-->
121+
122+
<!--codeinclude-->
123+
[Starting a Service Bus Emulator container](../../modules/azure/src/test/java/org/testcontainers/azure/AzureServiceBusContainerTest.java) inside_block:emulatorContainer
124+
<!--/codeinclude-->
125+
126+
#### Using Azure Service Bus clients
127+
128+
Configure the sender and the processor clients:
129+
130+
<!--codeinclude-->
131+
[Configuring the sender client](../../modules/azure/src/test/java/org/testcontainers/azure/AzureServiceBusContainerTest.java) inside_block:senderClient
132+
<!--/codeinclude-->
133+
134+
<!--codeinclude-->
135+
[Configuring the processor client](../../modules/azure/src/test/java/org/testcontainers/azure/AzureServiceBusContainerTest.java) inside_block:processorClient
136+
<!--/codeinclude-->
137+
75138
### CosmosDB
76139

77140
Start Azure CosmosDB Emulator during a test:

docs/modules/databases/scylladb.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# ScyllaDB
2+
3+
Testcontainers module for [ScyllaDB](https://hub.docker.com/r/scylladb/scylla)
4+
5+
## ScyllaDB's usage examples
6+
7+
You can start a ScyllaDB container instance from any Java application by using:
8+
9+
<!--codeinclude-->
10+
[Create container](../../../modules/scylladb/src/test/java/org/testcontainers/scylladb/ScyllaDBContainerTest.java) inside_block:container
11+
<!--/codeinclude-->
12+
13+
<!--codeinclude-->
14+
[Custom config file](../../../modules/scylladb/src/test/java/org/testcontainers/scylladb/ScyllaDBContainerTest.java) inside_block:customConfiguration
15+
<!--/codeinclude-->
16+
17+
### Building CqlSession
18+
19+
<!--codeinclude-->
20+
[Using CQL port](../../../modules/scylladb/src/test/java/org/testcontainers/scylladb/ScyllaDBContainerTest.java) inside_block:session
21+
<!--/codeinclude-->
22+
23+
<!--codeinclude-->
24+
[Using SSL](../../../modules/scylladb/src/test/java/org/testcontainers/scylladb/ScyllaDBContainerTest.java) inside_block:sslContext
25+
<!--/codeinclude-->
26+
27+
<!--codeinclude-->
28+
[Using Shard Awareness port](../../../modules/scylladb/src/test/java/org/testcontainers/scylladb/ScyllaDBContainerTest.java) inside_block:shardAwarenessSession
29+
<!--/codeinclude-->
30+
31+
### Alternator
32+
33+
<!--codeinclude-->
34+
[Enabling Alternator](../../../modules/scylladb/src/test/java/org/testcontainers/scylladb/ScyllaDBContainerTest.java) inside_block:alternator
35+
<!--/codeinclude-->
36+
37+
<!--codeinclude-->
38+
[DynamoDbClient with Alternator](../../../modules/scylladb/src/test/java/org/testcontainers/scylladb/ScyllaDBContainerTest.java) inside_block:dynamodDbClient
39+
<!--/codeinclude-->
40+
41+
## Adding this module to your project dependencies
42+
43+
Add the following dependency to your `pom.xml`/`build.gradle` file:
44+
45+
=== "Gradle"
46+
```groovy
47+
testImplementation "org.testcontainers:scylladb:{{latest_version}}"
48+
```
49+
50+
=== "Maven"
51+
```xml
52+
<dependency>
53+
<groupId>org.testcontainers</groupId>
54+
<artifactId>scylladb</artifactId>
55+
<version>{{latest_version}}</version>
56+
<scope>test</scope>
57+
</dependency>
58+
```

docs/modules/pinecone.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Pinecone
2+
3+
Testcontainers module for [Pinecone](https://github.com/orgs/pinecone-io/packages/container/package/pinecone-local).
4+
5+
## PineconeContainer's usage examples
6+
7+
You can start an Pinecone container instance from any Java application by using:
8+
9+
<!--codeinclude-->
10+
[Pinecone container](../../modules/pinecone/src/test/java/org/testcontainers/pinecone/PineconeContainerTest.java) inside_block:container
11+
<!--/codeinclude-->
12+
13+
## Adding this module to your project dependencies
14+
15+
Add the following dependency to your `pom.xml`/`build.gradle` file:
16+
17+
=== "Gradle"
18+
```groovy
19+
testImplementation "org.testcontainers:pinecone:{{latest_version}}"
20+
```
21+
22+
=== "Maven"
23+
```xml
24+
<dependency>
25+
<groupId>org.testcontainers</groupId>
26+
<artifactId>pinecone</artifactId>
27+
<version>{{latest_version}}</version>
28+
<scope>test</scope>
29+
</dependency>
30+
```
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
package com.example.kafkacluster;
2+
3+
import org.apache.kafka.common.Uuid;
4+
import org.awaitility.Awaitility;
5+
import org.testcontainers.containers.Container;
6+
import org.testcontainers.containers.GenericContainer;
7+
import org.testcontainers.containers.Network;
8+
import org.testcontainers.kafka.KafkaContainer;
9+
import org.testcontainers.lifecycle.Startable;
10+
import org.testcontainers.utility.DockerImageName;
11+
12+
import java.time.Duration;
13+
import java.util.Collection;
14+
import java.util.stream.Collectors;
15+
import java.util.stream.IntStream;
16+
17+
import static org.assertj.core.api.Assertions.assertThat;
18+
19+
public class ApacheKafkaContainerCluster implements Startable {
20+
21+
private final int brokersNum;
22+
23+
private final Network network;
24+
25+
private final Collection<KafkaContainer> brokers;
26+
27+
public ApacheKafkaContainerCluster(String version, int brokersNum, int internalTopicsRf) {
28+
if (brokersNum < 0) {
29+
throw new IllegalArgumentException("brokersNum '" + brokersNum + "' must be greater than 0");
30+
}
31+
if (internalTopicsRf < 0 || internalTopicsRf > brokersNum) {
32+
throw new IllegalArgumentException(
33+
"internalTopicsRf '" + internalTopicsRf + "' must be less than brokersNum and greater than 0"
34+
);
35+
}
36+
37+
this.brokersNum = brokersNum;
38+
this.network = Network.newNetwork();
39+
40+
String controllerQuorumVoters = IntStream
41+
.range(0, brokersNum)
42+
.mapToObj(brokerNum -> String.format("%d@broker-%d:9094", brokerNum, brokerNum))
43+
.collect(Collectors.joining(","));
44+
45+
String clusterId = Uuid.randomUuid().toString();
46+
47+
this.brokers =
48+
IntStream
49+
.range(0, brokersNum)
50+
.mapToObj(brokerNum -> {
51+
return new KafkaContainer(DockerImageName.parse("apache/kafka").withTag(version))
52+
.withNetwork(this.network)
53+
.withNetworkAliases("broker-" + brokerNum)
54+
.withEnv("CLUSTER_ID", clusterId)
55+
.withEnv("KAFKA_BROKER_ID", brokerNum + "")
56+
.withEnv("KAFKA_NODE_ID", brokerNum + "")
57+
.withEnv("KAFKA_CONTROLLER_QUORUM_VOTERS", controllerQuorumVoters)
58+
.withEnv("KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR", internalTopicsRf + "")
59+
.withEnv("KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS", "0")
60+
.withEnv("KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS", internalTopicsRf + "")
61+
.withEnv("KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR", internalTopicsRf + "")
62+
.withEnv("KAFKA_TRANSACTION_STATE_LOG_MIN_ISR", internalTopicsRf + "")
63+
.withStartupTimeout(Duration.ofMinutes(1));
64+
})
65+
.collect(Collectors.toList());
66+
}
67+
68+
public Collection<KafkaContainer> getBrokers() {
69+
return this.brokers;
70+
}
71+
72+
public String getBootstrapServers() {
73+
return brokers.stream().map(KafkaContainer::getBootstrapServers).collect(Collectors.joining(","));
74+
}
75+
76+
@Override
77+
public void start() {
78+
// Needs to start all the brokers at once
79+
brokers.parallelStream().forEach(GenericContainer::start);
80+
81+
Awaitility
82+
.await()
83+
.atMost(Duration.ofSeconds(30))
84+
.untilAsserted(() -> {
85+
Container.ExecResult result =
86+
this.brokers.stream()
87+
.findFirst()
88+
.get()
89+
.execInContainer(
90+
"sh",
91+
"-c",
92+
"/opt/kafka/bin/kafka-log-dirs.sh --bootstrap-server localhost:9093 --describe | grep -o '\"broker\"' | wc -l"
93+
);
94+
String brokers = result.getStdout().replace("\n", "");
95+
96+
assertThat(brokers).asInt().isEqualTo(this.brokersNum);
97+
});
98+
}
99+
100+
@Override
101+
public void stop() {
102+
this.brokers.stream().parallel().forEach(GenericContainer::stop);
103+
}
104+
}

0 commit comments

Comments
 (0)