diff --git a/ci/test.sh b/ci/test.sh index 5beea6647..cba733412 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -1,5 +1,5 @@ #!/bin/bash -ex -cd "${PWD}/tests/$@" +cd "${PWD}/tests/${1}" ./test.sh diff --git a/tests/conjur-host-identity/test.sh b/tests/conjur-host-identity/test.sh index ee2f4bcbb..b1fe9abd1 100755 --- a/tests/conjur-host-identity/test.sh +++ b/tests/conjur-host-identity/test.sh @@ -11,7 +11,8 @@ trap finish EXIT finish # normalises project name by filtering non alphanumeric characters and transforming to lowercase -declare -x COMPOSE_PROJECT_NAME=$(echo ${BUILD_TAG:-"ansible-role-testing"} | sed -e 's/[^[:alnum:]]//g' | tr '[:upper:]' '[:lower:]') +declare -x COMPOSE_PROJECT_NAME +COMPOSE_PROJECT_NAME=$(echo "${BUILD_TAG:-ansible-plugin-testing}" | sed -e 's/[^[:alnum:]]//g' | tr '[:upper:]' '[:lower:]') declare -x ANSIBLE_CONJUR_AUTHN_API_KEY='' declare -x CLI_CONJUR_AUTHN_API_KEY='' @@ -31,7 +32,9 @@ function api_key_for { } function hf_token { - echo $(docker exec ${cli_cid} conjur hostfactory tokens create --duration-days=5 ansible/ansible-factory | jq -r '.[0].token') + docker exec ${cli_cid} conjur hostfactory tokens create \ + --duration-days=5 \ + ansible/ansible-factory | jq -r '.[0].token' } function setup_conjur { @@ -46,9 +49,9 @@ function setup_conjur { } function run_test_cases { - for test_case in `ls test_cases`; do + for test_case in $(ls test_cases); do teardown_and_setup - run_test_case $test_case + run_test_case "${test_case}" done } @@ -57,11 +60,11 @@ function run_test_case { local test_case=$1 if [ ! -z "$test_case" ] then - docker exec ${ansible_cid} env HFTOKEN=$(hf_token) bash -c " + docker exec "${ansible_cid}" env HFTOKEN="$(hf_token)" bash -c " cd tests ansible-playbook test_cases/${test_case}/playbook.yml " - docker exec ${ansible_cid} bash -c " + docker exec "${ansible_cid}" bash -c " cd tests py.test --junitxml=./junit/${test_case} --connection docker -v test_cases/${test_case}/tests/test_default.py " @@ -77,10 +80,10 @@ function teardown_and_setup { } function wait_for_server { - docker exec ${cli_cid} bash -c ' + docker exec "${cli_cid}" bash -c ' for i in $(seq 20); do - curl -o /dev/null -fs -X OPTIONS ${CONJUR_APPLIANCE_URL} > /dev/null && echo "server is up" && break - echo "." + curl -o /dev/null -fs -X OPTIONS '${CONJUR_APPLIANCE_URL}' > /dev/null && echo server is up && break + echo . sleep 2 done ' diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index a28d2d6e3..ff057d853 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -1,6 +1,6 @@ Jenkinsfile shebang tests/conjur/test.sh shebang -tests/conjur-host-identity/test.sh shebang +tests/conjur-host-identity/test.sh shebang tests/conjur/policy/root.yml yamllint:unparsable-with-libyaml tests/conjur-host-identity/policy/root.yml yamllint:unparsable-with-libyaml # File loaded by summon utility (in Jenkinsfile), not via Python ci/build_release shebang