From 84cfb7488a0c7a1c9abb8bf5cee4ec3c0d7a0dc3 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Fri, 7 Aug 2020 17:49:10 +0200 Subject: [PATCH] Messaging support for stub runner boot With this change by adding --thin.profile=kafka or --thin.profile=rabbit we're able to turn on messaging support for stub runner boot. Also for Docker, you will be able to pass MESSAGING_TYPE env var with either rabbit or kafka as a value and we'll run the messaging support for you. fixes gh-1468 --- docker/spring-cloud-contract-stub-runner-docker/run.sh | 10 +++++++++- docs/src/main/asciidoc/docker-project.adoc | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docker/spring-cloud-contract-stub-runner-docker/run.sh b/docker/spring-cloud-contract-stub-runner-docker/run.sh index 3acd972ac7..ba2f3fa70d 100755 --- a/docker/spring-cloud-contract-stub-runner-docker/run.sh +++ b/docker/spring-cloud-contract-stub-runner-docker/run.sh @@ -6,4 +6,12 @@ set -o nounset set -o pipefail echo "Running Spring Cloud Contract Stub Runner" -java -Djava.security.egd=file:/dev/./urandom -jar /stub-runner-boot.jar +ADDITIONAL_OPTS="${ADDITIONAL_OPTS:-}" +MESSAGING_TYPE="${MESSAGING_TYPE:-}" + +if [[ "${MESSAGING_TYPE}" != "" ]]; then + echo "Messaging type passed, will active thin profile [${MESSAGING_TYPE}]" + ADDITIONAL_OPTS="${ADDITIONAL_OPTS} --thin.profile=${MESSAGING_TYPE}" +fi + +java -Djava.security.egd=file:/dev/./urandom -jar /stub-runner-boot.jar ${ADDITIONAL_OPTS} diff --git a/docs/src/main/asciidoc/docker-project.adoc b/docs/src/main/asciidoc/docker-project.adoc index da88b2f698..fa940bfdb6 100644 --- a/docs/src/main/asciidoc/docker-project.adoc +++ b/docs/src/main/asciidoc/docker-project.adoc @@ -110,6 +110,10 @@ from the container's `.m2`. Mount your local `.m2` as a volume available at the CAUTION: You must not set both `EXTERNAL_CONTRACTS_WORK_OFFLINE` and `EXTERNAL_CONTRACTS_REPO_WITH_BINARIES_URL`. +The following environment variables are used when running messaging based tests: + +- `MESSAGING_TYPE` - what type of messaging system are you using (currently supported are `rabbit`, `kafka`) + The following environment variables are used when tests are run: - `APPLICATION_BASE_URL`: URL against which tests should be run. @@ -214,6 +218,11 @@ The dot (`.`) should be replaced with underscore (`_`) characters. For example, the `stubrunner.repositoryRoot` property should be represented as a `STUBRUNNER_REPOSITORY_ROOT` environment variable. +In addition to those variables you can set the following ones: + +- `MESSAGING_TYPE` - what type of messaging system are you using (currently supported are `rabbit`, `kafka`) +- `ADDITIONAL_OPTS` - any additional properties that you would like to pass to the application + [[docker-stubrunner-example]] === Example of Usage