diff --git a/Makefile b/Makefile index 2c6c90b..a71ea39 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ install: build ansible-galaxy collection install -p ansible_collections community-okd-$(VERSION).tar.gz test-sanity: install - cd ansible_collections/community/okd && ansible-test sanity -v $(SANITY_TEST_ARGS) + cd ansible_collections/community/okd && ansible-test sanity --exclude ci/ -v $(SANITY_TEST_ARGS) test-integration: install molecule test diff --git a/ci/incluster_integration.sh b/ci/incluster_integration.sh index 8154fa6..79da03a 100755 --- a/ci/incluster_integration.sh +++ b/ci/incluster_integration.sh @@ -15,10 +15,10 @@ eval IMAGE=$IMAGE_FORMAT PULL_POLICY=${PULL_POLICY:-IfNotPresent} echo "Deleting test job if it exists" -kubectl delete job molecule-integration-test --wait --ignore-not-found +oc delete job molecule-integration-test --wait --ignore-not-found echo "Creating molecule test job" -cat << EOF | kubectl create -f - +cat << EOF | oc create -f - --- apiVersion: batch/v1 kind: Job @@ -40,25 +40,22 @@ spec: parallelism: 1 EOF -echo "Waiting for test job to report success" - -# Ensure the child processes are killed -trap 'kill $(jobs -p) || true' SIGINT SIGTERM EXIT - -# Wait for job completion in background -kubectl wait --for=condition=complete job/molecule-integration-test --timeout 5m & -completion_pid=$! - -# Wait for job failure in background -kubectl wait --for=condition=failed job/molecule-integration-test --timeout 5m && exit 1 & -failure_pid=$! - - -if wait -n $completion_pid $failure_pid ; then +function wait_for_success { + oc wait --for=condition=complete job/molecule-integration-test --timeout 5m echo "Molecule integration tests ran successfully" exit 0 -else - kubectl logs job/molecule-integration-test +} + +function wait_for_failure { + oc wait --for=condition=failed job/molecule-integration-test --timeout 5m + oc logs job/molecule-integration-test echo "Molecule integration tests failed, see logs for more information..." exit 1 -fi +} + +# Ensure the child processes are killed +trap 'kill -SIGTERM 0' SIGINT EXIT + +echo "Waiting for test job to complete" +wait_for_success & +wait_for_failure diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index 9e6bee7..4880ee6 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -1,4 +1,2 @@ plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc plugins/modules/k8s.py validate-modules:return-syntax-error -ci/incluster_integration.sh shebang!skip -ci/incluster_integration.sh shellcheck!skip diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index 9e6bee7..4880ee6 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -1,4 +1,2 @@ plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc plugins/modules/k8s.py validate-modules:return-syntax-error -ci/incluster_integration.sh shebang!skip -ci/incluster_integration.sh shellcheck!skip diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 737d1dc..bbfafd9 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -1,3 +1 @@ plugins/modules/k8s.py validate-modules:parameter-type-not-in-doc -ci/incluster_integration.sh shebang!skip -ci/incluster_integration.sh shellcheck!skip