From 642c0ead0daf19db1132e7551e48c7e624988bdc Mon Sep 17 00:00:00 2001 From: David Boreham Date: Thu, 22 Feb 2024 19:35:55 +0000 Subject: [PATCH] Add test for two config parameters (#758) Reviewed-on: https://git.vdb.to/cerc-io/stack-orchestrator/pulls/758 Co-authored-by: David Boreham Co-committed-by: David Boreham --- stack_orchestrator/data/compose/docker-compose-test.yml | 1 + .../data/container-build/cerc-test-container/run.sh | 9 +++++++++ tests/deploy/run-deploy-test.sh | 9 ++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/stack_orchestrator/data/compose/docker-compose-test.yml b/stack_orchestrator/data/compose/docker-compose-test.yml index 6ebbd714..7c8e8e95 100644 --- a/stack_orchestrator/data/compose/docker-compose-test.yml +++ b/stack_orchestrator/data/compose/docker-compose-test.yml @@ -6,6 +6,7 @@ services: CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_TEST_PARAM_1: ${CERC_TEST_PARAM_1:-FAILED} CERC_TEST_PARAM_2: "CERC_TEST_PARAM_2_VALUE" + CERC_TEST_PARAM_3: ${CERC_TEST_PARAM_3:-FAILED} volumes: - test-data-bind:/data - test-data-auto:/data2 diff --git a/stack_orchestrator/data/container-build/cerc-test-container/run.sh b/stack_orchestrator/data/container-build/cerc-test-container/run.sh index 8a5a53a9..d06f4df4 100755 --- a/stack_orchestrator/data/container-build/cerc-test-container/run.sh +++ b/stack_orchestrator/data/container-build/cerc-test-container/run.sh @@ -39,6 +39,15 @@ fi if [ -n "$CERC_TEST_PARAM_2" ]; then echo "Test-param-2: ${CERC_TEST_PARAM_2}" fi +if [ -n "$CERC_TEST_PARAM_3" ]; then + echo "Test-param-3: ${CERC_TEST_PARAM_3}" +fi +if [ -n "$CERC_TEST_PARAM_4" ]; then + echo "Test-param-4: ${CERC_TEST_PARAM_4}" +fi +if [ -n "$CERC_TEST_PARAM_5" ]; then + echo "Test-param-5: ${CERC_TEST_PARAM_5}" +fi if [ -d "/config" ]; then echo "/config: EXISTS" diff --git a/tests/deploy/run-deploy-test.sh b/tests/deploy/run-deploy-test.sh index 9dec2d46..fb574b03 100755 --- a/tests/deploy/run-deploy-test.sh +++ b/tests/deploy/run-deploy-test.sh @@ -83,7 +83,7 @@ $TEST_TARGET_SO --stack test deploy down --delete-volumes # Basic test of creating a deployment test_deployment_dir=$CERC_REPO_BASE_DIR/test-deployment-dir test_deployment_spec=$CERC_REPO_BASE_DIR/test-deployment-spec.yml -$TEST_TARGET_SO --stack test deploy init --output $test_deployment_spec --config CERC_TEST_PARAM_1=PASSED +$TEST_TARGET_SO --stack test deploy init --output $test_deployment_spec --config CERC_TEST_PARAM_1=PASSED,CERC_TEST_PARAM_3=FAST # Check the file now exists if [ ! -f "$test_deployment_spec" ]; then echo "deploy init test: spec file not present" @@ -141,6 +141,13 @@ else echo "deployment compose config test: FAILED" exit 1 fi +# Check the config variable CERC_TEST_PARAM_3 was passed correctly +if [[ "$log_output_3" == *"Test-param-3: FAST"* ]]; then + echo "deployment config test: passed" +else + echo "deployment config test: FAILED" + exit 1 +fi # Check that the ConfigMap is mounted and contains the expected content. log_output_4=$( $TEST_TARGET_SO deployment --dir $test_deployment_dir logs )