From f914f627f108a8f7dd8a947263bbbe3e3f172c96 Mon Sep 17 00:00:00 2001 From: Nikola Jokic Date: Thu, 7 Dec 2023 14:21:33 +0100 Subject: [PATCH] Fix workflow run in other tests, add logs --- .../actions.github.com/anonymous-proxy-setup.test.sh | 11 +++++++---- test/actions.github.com/auth-proxy-setup.test.sh | 7 ++++--- test/actions.github.com/default-setup.test.sh | 3 ++- test/actions.github.com/dind-setup.test.sh | 9 +++++---- test/actions.github.com/helper.sh | 6 +++--- .../actions.github.com/kubernetes-mode-setup.test.sh | 7 +++++-- test/actions.github.com/self-signed-ca-setup.test.sh | 12 +++++++++--- .../single-namespace-setup.test.sh | 7 +++++-- test/actions.github.com/update-strategy.test.sh | 5 +++-- 9 files changed, 43 insertions(+), 24 deletions(-) diff --git a/test/actions.github.com/anonymous-proxy-setup.test.sh b/test/actions.github.com/anonymous-proxy-setup.test.sh index 73b247f4..d501d23b 100755 --- a/test/actions.github.com/anonymous-proxy-setup.test.sh +++ b/test/actions.github.com/anonymous-proxy-setup.test.sh @@ -66,11 +66,14 @@ function main() { build_image create_cluster - install_arc - run_squid || failed+=("run_squid") - install_scale_set || failed+=("install_scale_set") - run_workflow || failed+=("run_workflow") + install_arc + run_squid + install_scale_set + + + WORKFLOW_FILE="${WORKFLOW_FILE}" SCALE_SET_NAME="${SCALE_SET_NAME}" run_workflow || failed+=("run_workflow") + INSTALLATION_NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" cleanup_scale_set || failed+=("cleanup_scale_set") delete_cluster diff --git a/test/actions.github.com/auth-proxy-setup.test.sh b/test/actions.github.com/auth-proxy-setup.test.sh index a7a36607..9869a4c7 100755 --- a/test/actions.github.com/auth-proxy-setup.test.sh +++ b/test/actions.github.com/auth-proxy-setup.test.sh @@ -76,10 +76,11 @@ function main() { build_image create_cluster install_arc + run_squid + install_scale_set + + WORKFLOW_FILE="${WORKFLOW_FILE}" SCALE_SET_NAME="${SCALE_SET_NAME}" run_workflow || failed+=("run_workflow") - run_squid || failed+=("run_squid") - install_scale_set || failed+=("install_scale_set") - run_workflow || failed+=("run_workflow") INSTALLATION_NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" cleanup_scale_set || failed+=("cleanup_scale_set") delete_cluster diff --git a/test/actions.github.com/default-setup.test.sh b/test/actions.github.com/default-setup.test.sh index b6d3b6b4..33661d22 100755 --- a/test/actions.github.com/default-setup.test.sh +++ b/test/actions.github.com/default-setup.test.sh @@ -59,9 +59,10 @@ function main() { create_cluster install_arc + install_scale_set - install_scale_set || failed+=("install_scale_set") WORKFLOW_FILE="${WORKFLOW_FILE}" SCALE_SET_NAME="${SCALE_SET_NAME}" run_workflow || failed+=("run_workflow") + INSTALLATION_NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" cleanup_scale_set || failed+=("cleanup_scale_set") delete_cluster diff --git a/test/actions.github.com/dind-setup.test.sh b/test/actions.github.com/dind-setup.test.sh index f469ed92..12d4cea8 100755 --- a/test/actions.github.com/dind-setup.test.sh +++ b/test/actions.github.com/dind-setup.test.sh @@ -52,15 +52,16 @@ function install_scale_set() { function main() { local failed=() - builf_image + build_image create_cluster - NAME="${ARC_NAME}" NAMESPACE="${ARC_NAMESPACE}" install_arc + install_arc + install_scale_set - install_scale_set || failed+=("install_scale_set") - run_workflow || failed+=("run_workflow") + WORKFLOW_FILE="${WORKFLOW_FILE}" SCALE_SET_NAME="${SCALE_SET_NAME}" run_workflow || failed+=("run_workflow") INSTALLATION_NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" cleanup_scale_set || failed+=("cleanup_scale_set") + NAMESPACE="${ARC_NAMESPACE}" arc_logs delete_cluster print_results "${failed[@]}" diff --git a/test/actions.github.com/helper.sh b/test/actions.github.com/helper.sh index 0fdd752a..23f3095f 100644 --- a/test/actions.github.com/helper.sh +++ b/test/actions.github.com/helper.sh @@ -127,7 +127,7 @@ function print_results() { function run_workflow() { echo "Checking if the workflow file exists" - gh workflow view -R "${TARGET_ORG}/${TARGET_REPO}" "${WORKFLOW_FILE}" || return 1 + gh workflow view -R "${TARGET_ORG}/${TARGET_REPO}" "${WORKFLOW_FILE}" &> /dev/null || return 1 local queue_time="$(date -u +%FT%TZ)" @@ -145,7 +145,7 @@ function run_workflow() { run_id=$(gh run list -R "${TARGET_ORG}/${TARGET_REPO}" --workflow "${WORKFLOW_FILE}" --created ">${queue_time}" --json "name,databaseId" --jq ".[] | select(.name | contains(\"${SCALE_SET_NAME}\")) | .databaseId") echo "Run ID: ${run_id}" if [ -n "$run_id" ]; then - echo "Run found: $run_id" + echo "Run found!" break fi @@ -155,7 +155,7 @@ function run_workflow() { done echo "Waiting for run to complete" - local code=$(gh run watch "${run_id}" -R "${TARGET_ORG}/${TARGET_REPO}" --exit-status) + local code=$(gh run watch "${run_id}" -R "${TARGET_ORG}/${TARGET_REPO}" --exit-status &> /dev/null) if [[ "${code}" -ne 0 ]]; then echo "Run failed with exit code ${code}" return 1 diff --git a/test/actions.github.com/kubernetes-mode-setup.test.sh b/test/actions.github.com/kubernetes-mode-setup.test.sh index 4a01707a..ef38d90a 100755 --- a/test/actions.github.com/kubernetes-mode-setup.test.sh +++ b/test/actions.github.com/kubernetes-mode-setup.test.sh @@ -59,10 +59,13 @@ function main() { create_cluster install_openebs install_arc - install_scale_set || failed+=("install_scale_set") - run_workflow || failed+=("run_workflow") + install_scale_set + + WORKFLOW_FILE="${WORKFLOW_FILE}" SCALE_SET_NAME="${SCALE_SET_NAME}" run_workflow || failed+=("run_workflow") + INSTALLATION_NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" cleanup_scale_set || failed+=("cleanup_scale_set") + NAMESPACE="${ARC_NAMESPACE}" arc_logs delete_cluster print_results "${failed[@]}" diff --git a/test/actions.github.com/self-signed-ca-setup.test.sh b/test/actions.github.com/self-signed-ca-setup.test.sh index c7b3481b..b7c45ea4 100755 --- a/test/actions.github.com/self-signed-ca-setup.test.sh +++ b/test/actions.github.com/self-signed-ca-setup.test.sh @@ -110,17 +110,23 @@ function run_mitmproxy() { } function main() { + if [[ ! -x "$(which mitmdump)" ]]; then + echo "mitmdump is not installed" + return 1 + fi + local failed=() build_image create_cluster install_arc + run_mitmproxy + install_scale_set - run_mitmproxy || failed+=("run_mitmproxy") - install_scale_set || failed+=("install_scale_set") - run_workflow || failed+=("run_workflow") + WORKFLOW_FILE="${WORKFLOW_FILE}" SCALE_SET_NAME="${SCALE_SET_NAME}" run_workflow || failed+=("run_workflow") INSTALLATION_NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" cleanup_scale_set || failed+=("cleanup_scale_set") + NAMESPACE="${ARC_NAMESPACE}" arc_logs delete_cluster print_results "${failed[@]}" diff --git a/test/actions.github.com/single-namespace-setup.test.sh b/test/actions.github.com/single-namespace-setup.test.sh index 0c1fb1d6..0b5fc347 100755 --- a/test/actions.github.com/single-namespace-setup.test.sh +++ b/test/actions.github.com/single-namespace-setup.test.sh @@ -58,10 +58,13 @@ function main() { build_image create_cluster install_arc - install_scale_set || failed+=("install_scale_set") - run_workflow || failed+=("run_workflow") + install_scale_set + + WORKFLOW_FILE="${WORKFLOW_FILE}" SCALE_SET_NAME="${SCALE_SET_NAME}" run_workflow || failed+=("run_workflow") + INSTALLATION_NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" cleanup_scale_set || failed+=("cleanup_scale_set") + NAMESPACE="${ARC_NAMESPACE}" arc_logs delete_cluster print_results "${failed[@]}" diff --git a/test/actions.github.com/update-strategy.test.sh b/test/actions.github.com/update-strategy.test.sh index e5b6ed1c..2dbb33a8 100755 --- a/test/actions.github.com/update-strategy.test.sh +++ b/test/actions.github.com/update-strategy.test.sh @@ -125,15 +125,16 @@ function main() { build_image create_cluster install_arc + install_scale_set - install_scale_set || failed+=("install_scale_set") - run_workflow || failed+=("run_workflow_1") + WORKFLOW_FILE="${WORKFLOW_FILE}" SCALE_SET_NAME="${SCALE_SET_NAME}" run_workflow || failed+=("run_workflow") upgrade_scale_set || failed+=("upgrade_scale_set") assert_listener_deleted || failed+=("assert_listener_deleted") assert_listener_recreated || failed+=("assert_listener_recreated") INSTALLATION_NAME="${SCALE_SET_NAME}" NAMESPACE="${SCALE_SET_NAMESPACE}" cleanup_scale_set || failed+=("cleanup_scale_set") + NAMESPACE="${ARC_NAMESPACE}" arc_logs delete_cluster