From bac43b07091c8435b6218e17df893f64f35868f5 Mon Sep 17 00:00:00 2001 From: Charlie Wheeler-Robinson Date: Mon, 15 Apr 2024 12:02:17 -0400 Subject: [PATCH] add check for existing data before collecting Signed-off-by: Charlie Wheeler-Robinson --- cmd/e2e.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/e2e.sh b/cmd/e2e.sh index 1251d3d..7ec384e 100755 --- a/cmd/e2e.sh +++ b/cmd/e2e.sh @@ -267,17 +267,22 @@ EOF popd >/dev/null 2>&1 } -audit_container > $DATADIR/repo_audit if [ ! -z "$LOCAL_KUBECONFIG" ]; then - echo "Running Collection" - verify_env - collect_data + if [ -z "$(find $OUTPUTDIR/*.* -type f 2> /dev/null)" ] | [ -z "$(find $DATADIR/* -type f 2> /dev/null)" ]; then + echo "Running Collection" + verify_env + collect_data + else + echo "Cannot run data collection when $OUTPUTDIR contains files." + exit 1 + fi else echo "Skipping data collection" fi analyse_data > $TESTJSON create_junit create_pdf +audit_container > $DATADIR/repo_audit # Make exit code indicate test results rather than successful completion. if grep -Eq '(errors|failures)=\"([^0].*?)\"' $FULLJUNIT; then