Skip to content

Commit 0241296

Browse files
authored
Merge pull request #622 from agebhar1/feature/tc2
build(deps-dev): Bump org.testcontainers:testcontainers from 1.21.3 to 2.0.1
2 parents abaf0d6 + 3433be4 commit 0241296

File tree

7 files changed

+37
-27
lines changed

7 files changed

+37
-27
lines changed

.github/workflows/e2e.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ jobs:
4343
distribution: "temurin"
4444
java-version: ${{ matrix.java }}
4545
cache: "maven"
46+
- name: Set up Docker Compose
47+
uses: docker/setup-compose-action@364cc21a5de5b1ee4a7f5f9d3fa374ce0ccde746 # v1.2.0
48+
with:
49+
version: v2.40.3
4650
- name: Run Kafka Connect ${{ matrix.kafka }} E2E Tests with Apache Kafka
4751
run: |
4852
echo "Running integration tests with Docker Compose file: ${COMPOSE_FILE}"
@@ -69,6 +73,10 @@ jobs:
6973
distribution: "temurin"
7074
java-version: ${{ matrix.java }}
7175
cache: "maven"
76+
- name: Set up Docker Compose
77+
uses: docker/setup-compose-action@364cc21a5de5b1ee4a7f5f9d3fa374ce0ccde746 # v1.2.0
78+
with:
79+
version: v2.40.3
7280
- name: Run Confluent Kafka Platform ${{ matrix.kafka }} E2E Tests
7381
run: |
7482
echo "Running integration tests with Docker Compose file: ${COMPOSE_FILE}"
@@ -97,6 +105,10 @@ jobs:
97105
distribution: "temurin"
98106
java-version: ${{ matrix.java }}
99107
cache: "maven"
108+
- name: Set up Docker Compose
109+
uses: docker/setup-compose-action@364cc21a5de5b1ee4a7f5f9d3fa374ce0ccde746 # v1.2.0
110+
with:
111+
version: v2.40.3
100112
- name: Run Kafka Connect ${{ matrix.kafka }} E2E Tests with Redpanda ${{ matrix.redpanda }}
101113
run: |
102114
echo "Running integration tests with Docker Compose file: ${COMPOSE_FILE}"

CONTRIBUTING.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ mvn clean package -Drevision=$(git describe --tags --always)
8585

8686
#### Integration Tests with Docker Compose
8787

88-
To execute the integration tests (requires [Docker](https://docker.com/)) run:
88+
To execute the integration tests (requires [Docker](https://docker.com/) with [compose](https://github.com/docker/compose) plugin) run:
8989

9090
```bash
91-
export KAFKA_VERSION=4.0.0
91+
export KAFKA_VERSION=4.1.0
9292
export COMPOSE_FILE=e2e/docker_compose.yaml
9393
mvn clean verify -Drevision=$(git describe --tags --always)
9494
```
@@ -116,9 +116,6 @@ locally e.g., to create the local environment:
116116
```bash
117117
# create the JAR which will be loaded into Kafka Connect (Docker Volume)
118118
mvn clean package -Drevision=$(git describe --tags --always)
119-
120-
# move to the e2e directory
121-
cd e2e
122119
```
123120

124121
Skip the next step if you already have these credentials configured in your environment:
@@ -139,7 +136,7 @@ export AWS_SESSION_TOKEN=ABCDEFGHIJKLMNOPQRST
139136
The following command removes any previous resources and creates the local test environment:
140137

141138
```bash
142-
docker compose -f docker_compose.yaml down --remove-orphans -v && docker compose -f docker_compose.yaml up
139+
docker compose -f e2e/docker_compose.yaml down --remove-orphans -v && docker compose -f e2e/docker_compose.yaml up
143140
```
144141

145142
> [!NOTE]
@@ -153,10 +150,10 @@ e2e-connect-1 | [2023-07-12 09:07:29,263] INFO Kafka Connect started (org.ap
153150
```
154151

155152
Change the JSON configuration example `connect-config.json` (uses LocalStack defaults) according to your
156-
environment. In a separate terminal (within the `e2e` folder) deploy the connector:
153+
environment. In a separate terminal (within the project root folder) deploy the connector:
157154

158155
```bash
159-
curl -i --fail-with-body -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://$(docker compose -f docker_compose.yaml port connect 8083)/connectors/ -d @connect-config.json
156+
curl -i --fail-with-body -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://$(docker compose -f e2e/docker_compose.yaml port connect 8083)/connectors/ -d @e2e/connect-config.json
160157
```
161158

162159
The output should look like:
@@ -184,7 +181,7 @@ Produce a Kafka record to invoke the EventBridge sink connector:
184181

185182
```bash
186183
# open a shell in the Kafka broker container
187-
docker compose -f docker_compose.yaml exec -w /opt/kafka/bin kafka /bin/bash
184+
docker compose -f e2e/docker_compose.yaml exec -w /opt/kafka/bin kafka /bin/bash
188185

189186
# produce an event
190187
# replace the topic with your connector settings if needed
@@ -231,7 +228,7 @@ The output event should look similar to the below:
231228
To tear down the environment run:
232229

233230
```bash
234-
docker compose -f docker_compose.yaml down --remove-orphans -v
231+
docker compose -f e2e/docker_compose.yaml down --remove-orphans -v
235232
```
236233

237234
##### Remote Debug the Connector

e2e/docker_compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ services:
3333
KAFKA_LOG4J_OPTS: -Dlog4j.configuration=file:/mnt/connect-log4j.properties
3434
# KAFKA_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
3535
volumes:
36-
- ${PWD}:/mnt
37-
- ${PWD}/../target:/opt/connectors/kafka-eventbridge-sink
36+
- ${PWD}/e2e:/mnt
37+
- ${PWD}/target:/opt/connectors/kafka-eventbridge-sink
3838
command: ["/bin/bash","-c","env && /opt/kafka/bin/connect-standalone.sh /mnt/connect-standalone.properties"]
3939

4040
localstack:

e2e/docker_compose_confluent.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ services:
5252
AWS_SESSION_TOKEN: ${AWS_SESSION_TOKEN}
5353
# KAFKA_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
5454
volumes:
55-
- ${PWD}/../target:/usr/local/share/java/connect/kafka-eventbridge-sink
55+
- ${PWD}/target:/usr/local/share/java/connect/kafka-eventbridge-sink
5656

5757
localstack:
5858
image: docker.io/localstack/localstack:4.9.2

e2e/docker_compose_redpanda.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ services:
3030
KAFKA_LOG4J_OPTS: -Dlog4j.configuration=file:/mnt/connect-log4j.properties
3131
# KAFKA_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
3232
volumes:
33-
- ${PWD}:/mnt
34-
- ${PWD}/../target:/opt/connectors/kafka-eventbridge-sink
33+
- ${PWD}/e2e:/mnt
34+
- ${PWD}/target:/opt/connectors/kafka-eventbridge-sink
3535
command: ["/bin/bash","-c","env && /opt/kafka/bin/connect-standalone.sh /mnt/connect-standalone.properties"]
3636

3737
localstack:

pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<org.mockito.version>5.20.0</org.mockito.version>
4040
<org.slf4j.version>2.0.17</org.slf4j.version>
4141
<org.skyscreamer.version>1.5.3</org.skyscreamer.version>
42-
<org.testcontainers.version>1.21.3</org.testcontainers.version>
42+
<org.testcontainers.version>2.0.1</org.testcontainers.version>
4343
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4444
</properties>
4545

@@ -158,8 +158,7 @@
158158
</dependency>
159159
<dependency>
160160
<groupId>org.testcontainers</groupId>
161-
<artifactId>junit-jupiter</artifactId>
162-
<version>1.21.3</version>
161+
<artifactId>testcontainers-junit-jupiter</artifactId>
163162
<scope>test</scope>
164163
</dependency>
165164
</dependencies>
@@ -274,8 +273,10 @@
274273
</dependency>
275274
<dependency>
276275
<groupId>org.testcontainers</groupId>
277-
<artifactId>testcontainers</artifactId>
276+
<artifactId>testcontainers-bom</artifactId>
278277
<version>${org.testcontainers.version}</version>
278+
<scope>import</scope>
279+
<type>pom</type>
279280
</dependency>
280281
<dependency>
281282
<groupId>org.skyscreamer</groupId>

src/test/java/software/amazon/event/kafkaconnector/AbstractEventBridgeSinkConnectorIT.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.junit.jupiter.api.TestInstance;
3737
import org.slf4j.Logger;
3838
import org.slf4j.LoggerFactory;
39-
import org.testcontainers.containers.DockerComposeContainer;
39+
import org.testcontainers.containers.ComposeContainer;
4040
import org.testcontainers.containers.output.Slf4jLogConsumer;
4141
import org.testcontainers.containers.wait.strategy.Wait;
4242
import org.testcontainers.junit.jupiter.Testcontainers;
@@ -64,28 +64,28 @@ public abstract class AbstractEventBridgeSinkConnectorIT {
6464
private static final String KAFKA_VERSION_ENV = "KAFKA_VERSION";
6565
private static final String REDPANDA_VERSION_ENV = "REDPANDA_VERSION";
6666

67-
private static final String CONNECT_SERVICE = "connect_1";
67+
private static final String CONNECT_SERVICE = "connect";
6868
private static final int CONNECT_EXPOSED_SERVICE_PORT = 8083;
6969

70-
private static final String LOCALSTACK_SERVICE = "localstack_1";
70+
private static final String LOCALSTACK_SERVICE = "localstack";
7171
private static final int LOCALSTACK_EXPOSED_SERVICE_PORT = 4566;
7272

7373
private static final String AWS_ACCESS_KEY_ID = "test";
7474
private static final String AWS_SECRET_ACCESS_KEY = "test";
7575

76-
private final String RUNNING_STATE = "RUNNING";
76+
private static final String RUNNING_STATE = "RUNNING";
7777

78-
protected final String TEST_RESOURCE_NAME = "eventbridge-e2e";
78+
protected static final String TEST_RESOURCE_NAME = "eventbridge-e2e";
7979

80-
protected final String TEST_BUCKET_NAME = "test-bucket";
80+
protected static final String TEST_BUCKET_NAME = "test-bucket";
8181

8282
private String connectorName = null;
8383

8484
protected static final Logger log =
8585
LoggerFactory.getLogger(AbstractEventBridgeSinkConnectorIT.class);
8686

87-
private final DockerComposeContainer<?> environment =
88-
new DockerComposeContainer<>("e2e", getComposeFile())
87+
private final ComposeContainer environment =
88+
new ComposeContainer("e2e", getComposeFile())
8989
.withLogConsumer("connect", new Slf4jLogConsumer(log).withSeparateOutputStreams())
9090
.withEnv("AWS_ACCESS_KEY_ID", AWS_ACCESS_KEY_ID)
9191
.withEnv("AWS_SECRET_ACCESS_KEY", AWS_SECRET_ACCESS_KEY)

0 commit comments

Comments
 (0)