Skip to content

Commit e30dc2d

Browse files
salaboyartursouza
andauthored
Initial Testcontainers integration for Dapr (#1085)
* initial testcontainers pr Signed-off-by: salaboy <[email protected]> * fixing variable reference Signed-off-by: salaboy <[email protected]> * adding equals to spotbug issues Signed-off-by: salaboy <[email protected]> * adding http port to run tests Signed-off-by: salaboy <[email protected]> * updating pom Signed-off-by: salaboy <[email protected]> * fixing style Signed-off-by: salaboy <[email protected]> * extracting classes Signed-off-by: salaboy <[email protected]> * removing restassured dependency Signed-off-by: salaboy <[email protected]> * refactoring IT out to sdk-tests Signed-off-by: salaboy <[email protected]> * adding correct wiremock dep version Signed-off-by: salaboy <[email protected]> * missing header Signed-off-by: salaboy <[email protected]> * fixing spotbugs issue Signed-off-by: salaboy <[email protected]> * adding hashcode too Signed-off-by: salaboy <[email protected]> * testing configure method Signed-off-by: salaboy <[email protected]> * making inmutable collections and maps Signed-off-by: salaboy <[email protected]> * checkstyle Signed-off-by: salaboy <[email protected]> * removing space Signed-off-by: salaboy <[email protected]> * Refactor tracking of alpha artifact version Signed-off-by: Artur Souza <[email protected]> Signed-off-by: salaboy <[email protected]> * Use Usage: docker compose [OPTIONS] COMMAND Define and run multi-container applications with Docker Options: --all-resources Include all resources, even those not used by services --ansi string Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto") --compatibility Run compose in backward compatibility mode --dry-run Execute command in dry run mode --env-file stringArray Specify an alternate environment file -f, --file stringArray Compose configuration files --parallel int Control max parallelism, -1 for unlimited (default -1) --profile stringArray Specify a profile to enable --progress string Set type of progress output (auto, tty, plain, quiet) (default "auto") --project-directory string Specify an alternate working directory (default: the path of the, first specified, Compose file) -p, --project-name string Project name Commands: attach Attach local standard input, output, and error streams to a service's running container build Build or rebuild services config Parse, resolve and render compose file in canonical format cp Copy files/folders between a service container and the local filesystem create Creates containers for a service down Stop and remove containers, networks events Receive real time events from containers exec Execute a command in a running container images List images used by the created containers kill Force stop service containers logs View output from containers ls List running compose projects pause Pause services port Print the public port for a port binding ps List containers pull Pull service images push Push service images restart Restart service containers rm Removes stopped service containers run Run a one-off command on a service scale Scale services start Start services stats Display a live stream of container(s) resource usage statistics stop Stop services top Display the running processes unpause Unpause services up Create and start containers version Show the Docker Compose version information wait Block until the first service container stops watch Watch build context for service and rebuild/refresh containers when files are updated Run 'docker compose COMMAND --help' for more information on a command. instead of docker-compose Signed-off-by: Artur Souza <[email protected]> Signed-off-by: salaboy <[email protected]> * removing version from docker compose Signed-off-by: salaboy <[email protected]> * Update README.md Signed-off-by: Artur Souza <[email protected]> --------- Signed-off-by: salaboy <[email protected]> Signed-off-by: Artur Souza <[email protected]> Co-authored-by: Artur Souza <[email protected]>
1 parent 5618af5 commit e30dc2d

File tree

24 files changed

+1148
-21
lines changed

24 files changed

+1148
-21
lines changed

.github/scripts/update_sdk_version.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@ set -uex
44

55
DAPR_JAVA_SDK_VERSION=$1
66

7-
# The workflows sdk tracks the regular SDK minor and patch versions, just not the major.
8-
# Replaces the workflows SDK major version to 0 until it is stable.
9-
DAPR_JAVA_WORKFLOWS_SDK_VERSION=`echo $DAPR_JAVA_SDK_VERSION | sed 's/^[0-9]*\./0./'`
7+
# Alpha artifacts of the sdk tracks the regular SDK minor and patch versions, just not the major.
8+
# Replaces the SDK major version to 0 for alpha artifacts.
9+
DAPR_JAVA_SDK_ALPHA_VERSION=`echo $DAPR_JAVA_SDK_VERSION | sed 's/^[0-9]*\./0./'`
1010

1111
mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_VERSION
12+
mvn versions:set-property -Dproperty=dapr.sdk.alpha.version -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION
1213
mvn versions:set-property -Dproperty=dapr.sdk.version -DnewVersion=$DAPR_JAVA_SDK_VERSION -f sdk-tests/pom.xml
14+
mvn versions:set-property -Dproperty=dapr.sdk.alpha.version -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f sdk-tests/pom.xml
1315

14-
mvn versions:set -DnewVersion=$DAPR_JAVA_WORKFLOWS_SDK_VERSION -f sdk-workflows/pom.xml
15-
mvn versions:set-property -Dproperty=dapr.sdk-workflows.version -DnewVersion=$DAPR_JAVA_WORKFLOWS_SDK_VERSION
16+
###################
17+
# Alpha artifacts #
18+
###################
19+
20+
# sdk-workflows
21+
mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f sdk-workflows/pom.xml
22+
23+
# testcontainers-dapr
24+
mvn versions:set -DnewVersion=$DAPR_JAVA_SDK_ALPHA_VERSION -f testcontainers-dapr/pom.xml
1625

1726
git clean -f

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
./dist/linux_amd64/release/placement &
100100
- name: Spin local environment
101101
run: |
102-
docker-compose -f ./sdk-tests/deploy/local-test.yml up -d mongo kafka
102+
docker compose -f ./sdk-tests/deploy/local-test.yml up -d mongo kafka
103103
docker ps
104104
- name: Install local ToxiProxy to simulate connectivity issues to Dapr sidecar
105105
run: |

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,13 @@ Similarly, all of these need to be run for running the ITs either individually o
237237
Run the following commands from the root of the repo to start all the docker containers that the tests depend on.
238238
239239
```bash
240-
docker-compose -f ./sdk-tests/deploy/local-test.yml up -d
240+
docker compose -f ./sdk-tests/deploy/local-test.yml up -d
241241
```
242242
243243
To stop the containers and services, run the following commands.
244244
245245
```bash
246-
docker-compose -f ./sdk-tests/deploy/local-test.yml down
246+
docker compose -f ./sdk-tests/deploy/local-test.yml down
247247
```
248248
249249

examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<dependency>
114114
<groupId>io.dapr</groupId>
115115
<artifactId>dapr-sdk-workflows</artifactId>
116-
<version>${dapr.sdk-workflows.version}</version>
116+
<version>${dapr.sdk.alpha.version}</version>
117117
</dependency>
118118
<dependency>
119119
<groupId>io.dapr</groupId>

examples/src/main/java/io/dapr/examples/bindings/http/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,11 @@ Before getting into the application code, follow these steps in order to set up
5858

5959
<!-- STEP
6060
name: Setup kafka container
61-
expected_stderr_lines:
62-
- 'Creating network "http_default" with the default driver'
6361
sleep: 20
6462
-->
6563

6664
```bash
67-
docker-compose -f ./src/main/java/io/dapr/examples/bindings/http/docker-compose-single-kafka.yml up -d
65+
docker compose -f ./src/main/java/io/dapr/examples/bindings/http/docker-compose-single-kafka.yml up -d
6866
```
6967

7068
<!-- END_STEP -->
@@ -248,7 +246,7 @@ name: Cleanup Kafka containers
248246
-->
249247

250248
```bash
251-
docker-compose -f ./src/main/java/io/dapr/examples/bindings/http/docker-compose-single-kafka.yml down
249+
docker compose -f ./src/main/java/io/dapr/examples/bindings/http/docker-compose-single-kafka.yml down
252250
```
253251

254252
<!-- END_STEP -->

examples/src/main/java/io/dapr/examples/bindings/http/docker-compose-single-kafka.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3'
21
services:
32
zookeeper:
43
image: confluentinc/cp-zookeeper:7.4.4

examples/src/main/java/io/dapr/examples/querystate/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ sleep: 5
4444
-->
4545

4646
```bash
47-
docker-compose -f ./src/main/java/io/dapr/examples/querystate/docker-compose-single-mongo.yml up -d
47+
docker compose -f ./src/main/java/io/dapr/examples/querystate/docker-compose-single-mongo.yml up -d
4848
```
4949

5050
<!-- END_STEP -->
@@ -305,7 +305,7 @@ name: Cleanup MongoDB containers
305305
-->
306306

307307
```bash
308-
docker-compose -f ./src/main/java/io/dapr/examples/querystate/docker-compose-single-mongo.yml down
308+
docker compose -f ./src/main/java/io/dapr/examples/querystate/docker-compose-single-mongo.yml down
309309
```
310310

311311
<!-- END_STEP -->

examples/src/main/java/io/dapr/examples/querystate/docker-compose-single-mongo.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3'
21
services:
32
mongo:
43
image: mongo

examples/src/main/java/io/dapr/examples/state/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ sleep: 5
4444
-->
4545

4646
```bash
47-
docker-compose -f ./src/main/java/io/dapr/examples/state/docker-compose-single-mongo.yml up -d
47+
docker compose -f ./src/main/java/io/dapr/examples/state/docker-compose-single-mongo.yml up -d
4848
```
4949

5050
<!-- END_STEP -->
@@ -227,7 +227,7 @@ name: Cleanup MongoDB container
227227
-->
228228

229229
```bash
230-
docker-compose -f ./src/main/java/io/dapr/examples/state/docker-compose-single-mongo.yml down
230+
docker compose -f ./src/main/java/io/dapr/examples/state/docker-compose-single-mongo.yml down
231231
```
232232

233233
<!-- END_STEP -->

examples/src/main/java/io/dapr/examples/state/docker-compose-single-mongo.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3'
21
services:
32
mongo:
43
image: mongo

0 commit comments

Comments
 (0)