Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

523: only retain ocp cluster when e2e test fail #529

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion scripts/acceptance-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,24 @@ done
echo "****** Test results"
exit_code=0
for test in "${!E2E_TESTS[@]}"; do
if [[ "${test}" == "kind-e2e-run" ]]; then
TEST_ID=$KIND_E2E_TEST;
elif [[ "${test}" == "ocp-e2e-run-X" ]]; then
TEST_ID=$OCP_E2E_X_TEST;
elif [[ "${test}" == "ocp-e2e-run-P" ]]; then
TEST_ID=$OCP_E2E_P_TEST;
elif [[ "${test}" == "ocp-e2e-run-Z" ]]; then
TEST_ID=$OCP_E2E_Z_TEST;
else
TEST_ID=$UNKNOWN_E2E_TEST
fi

status="$(docker ps --all --no-trunc --filter name="^/${test}$" --format='{{.Status}}')"
if echo "${status}" | grep -q "Exited (0)"; then
echo "[PASSED] ${test}"
else
echo "[FAILED] ${test}: ${status}"
exit_code=1
exit_code=$((exit_code + $TEST_ID))
fi
done
exit ${exit_code}
17 changes: 16 additions & 1 deletion scripts/pipeline/runTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ export FYRE_KEY=$(get_env fyre-key)
export FYRE_PASS=$(get_env fyre-pass)
export FYRE_PRODUCT_GROUP_ID=$(get_env fyre-product-group-id)

# acceptance-test.sh return values
export KIND_E2E_TEST=1
export OCP_E2E_X_TEST=2
export OCP_E2E_P_TEST=4
export OCP_E2E_Z_TEST=8
export UNKNOWN_E2E_TEST=256

echo "${PIPELINE_PASSWORD}" | docker login "${PIPELINE_REGISTRY}" -u "${PIPELINE_USERNAME}" --password-stdin
if [[ ! -z "$RELEASE_ACCEPTANCE_TEST" && "$RELEASE_ACCEPTANCE_TEST" != "false" && "$RELEASE_ACCEPTANCE_TEST" != "no" ]]; then
RELEASE_TARGET=$(curl --silent "https://api.github.com/repos/WASdev/websphere-liberty-operator/releases/latest" | jq -r .tag_name)
Expand All @@ -71,11 +78,19 @@ pwd

scripts/acceptance-test.sh
rc=$?
keep_cluster=0

if (( (rc & OCP_E2E_X_TEST) >0 )) ||
(( (rc & OCP_E2E_P_TEST) >0 )) ||
(( (rc & OCP_E2E_Z_TEST) >0 )) ||
(( (rc & UNKNOWN_E2E_TEST) >0 )); then
keep_cluster=1
fi

echo "switching back to ebc-gateway-http directory"
cd scripts/pipeline/ebc-gateway-http

if [[ "$rc" == 0 ]]; then
if [[ "$keep_cluster" == 0 ]]; then
./ebc_complete.sh
else
hours=$(get_env ebc_autocomplete_hours "6")
Expand Down