Skip to content

Commit c7fcea4

Browse files
committed
Add env vars for Gradle commands in test scripts
The following env vars can be set to control which tests are run UAA_GRADLE_INT_TEST_COMMAND UAA_GRADLE_UNIT_TEST_COMMAND the UAA_DOCKER_ARGS env var can be set to pass additional settings to the docker container
1 parent fc111e5 commit c7fcea4

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

run-integration-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ set -eu -o pipefail
33

44
#######################################
55
# main function to run the integration tests
6+
# Global env vars:
7+
# UAA_DOCKER_ARGS: Additional args to pass to docker run
8+
# UAA_GRADLE_INT_TEST_COMMAND: Gradle command to run integration tests (default: integrationTest)
9+
# this could include :cloudfoundry-identity-server:integrationTest --tests to run specific tests
610
#######################################
711
main() {
812
local script_dir; script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -30,6 +34,8 @@ main() {
3034
--env DB="${DB}" \
3135
--env RUN_TESTS="${RUN_TESTS:-true}" \
3236
--publish 8081:8080 \
37+
${UAA_DOCKER_ARGS:-} \
38+
--env UAA_GRADLE_INT_TEST_COMMAND="${UAA_GRADLE_INT_TEST_COMMAND:-integrationTest}" \
3339
"${DOCKER_IMAGE}" \
3440
/root/uaa/scripts/integration_tests.sh "${PROFILE_NAME}" "${run_as_boot}"
3541
}

run-unit-tests.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ set -eu -o pipefail
33

44
#######################################
55
# main function to run the unit tests
6+
# Global env vars:
7+
# UAA_DOCKER_ARGS: Additional args to pass to docker run
8+
# UAA_GRADLE_UNIT_TEST_COMMAND: Gradle command to run unit tests (default: test)
9+
# this could include :cloudfoundry-identity-server:test --tests to run specific tests
610
#######################################
711
main() {
8-
local script_dir; script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
12+
local script_dir; script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
913
source "${script_dir}/scripts/lib_timer.sh"
1014
start_timer
1115

@@ -27,6 +31,8 @@ main() {
2731
--volume "${script_dir}":"${container_script_dir}" \
2832
--volume "${gradle_lock_dir}" \
2933
--env DB="${DB}" \
34+
${UAA_DOCKER_ARGS:-} \
35+
--env UAA_GRADLE_UNIT_TEST_COMMAND="${UAA_GRADLE_UNIT_TEST_COMMAND:-test}" \
3036
"${DOCKER_IMAGE}" \
3137
/root/uaa/scripts/unit_tests.sh "${PROFILE_NAME}"
3238
}

scripts/integration_tests.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ set -eu
33

44
#######################################
55
# The main function to run the integration tests within a container
6+
# Global env vars:
7+
# UAA_GRADLE_INT_TEST_COMMAND: Gradle command to run integration tests (default: integrationTest)
8+
# this could include :cloudfoundry-identity-server:integrationTest --tests to run specific tests
69
#######################################
710
function main() {
811
local script_dir; script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -50,7 +53,7 @@ function main() {
5053

5154
readonly integration_test_code="./gradlew '-Dspring.profiles.active=${test_profile}' '${skip_boot_run}' \
5255
'-Djava.security.egd=file:/dev/./urandom' \
53-
integrationTest \
56+
${UAA_GRADLE_INT_TEST_COMMAND:-integrationTest} \
5457
--stacktrace \
5558
--console=plain"
5659

scripts/start_docker_database.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ set -eu -o pipefail
55
# main function to start a docker container with the specified database
66
# usage: start_docker_database.sh [db_name]
77
# db_name: one of "mysql(-*)", "postgres(-*)", etc. (default: "mysql")
8+
# Global env vars:
9+
# DEBUG_MODE: if set to any value, enables remote debugging on port 5005
10+
# WEB_MODE: if set to any value, enables web access on port 8080
11+
# UAA_DOCKER_ARGS: Additional args to pass to docker run
812
#######################################
913
main() {
1014
local uaa_dir; uaa_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
@@ -43,6 +47,7 @@ main() {
4347
--publish "${db_port}:${db_port}" \
4448
${DEBUG_MODE:+--publish "5005:5005"} \
4549
${WEB_MODE:+--publish "8080:8080"} \
50+
${UAA_DOCKER_ARGS:-} \
4651
"${DOCKER_IMAGE}"
4752
}
4853

scripts/unit_tests.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ set -eu
33

44
#######################################
55
# The main function to run the unit tests within a container
6+
# Global env vars:
7+
# UAA_GRADLE_UNIT_TEST_COMMAND: Gradle command to run unit tests (default: test)
8+
# this could include :cloudfoundry-identity-server:test --tests to run specific tests
69
#######################################
710
function main() {
811
local script_dir; script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -23,7 +26,7 @@ function main() {
2326
export GRADLE_OPTS="-Xmx2048m"
2427
./gradlew "-Dspring.profiles.active=${test_profile}" \
2528
"-Djava.security.egd=file:/dev/./urandom" \
26-
test \
29+
${UAA_GRADLE_UNIT_TEST_COMMAND:-test} \
2730
--stacktrace \
2831
--console=plain
2932
popd

0 commit comments

Comments
 (0)