From 13f16b9c8524a2160ae68828c5b7a45f15c195ef Mon Sep 17 00:00:00 2001 From: Daniel Flook Date: Sat, 1 Jun 2024 15:06:45 +0100 Subject: [PATCH] Implement a bit of sanity --- .github/workflows/test-test.yaml | 10 +++++----- image/entrypoints/test.sh | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-test.yaml b/.github/workflows/test-test.yaml index 68c84244..8a619731 100644 --- a/.github/workflows/test-test.yaml +++ b/.github/workflows/test-test.yaml @@ -86,12 +86,12 @@ jobs: - name: Check failure run: | - if [[ "${{ steps.failing.outcome }}" != "failure" ]]; then + if [[ "${{ steps.nonexistent_test_dir.outcome }}" != "failure" ]]; then echo "Test did not fail correctly" exit 1 fi - if [[ "${{ steps.failing.outputs.failure-reason }}" != "no-tests" ]]; then + if [[ "${{ steps.nonexistent_test_dir.outputs.failure-reason }}" != "no-tests" ]]; then echo "::error:: failure-reason not set correctly" exit 1 fi @@ -105,7 +105,7 @@ jobs: - name: Test uses: ./terraform-test - id: nonexistent_test_dir + id: faulty_filter continue-on-error: true with: path: tests/workflows/test-test/local @@ -115,12 +115,12 @@ jobs: - name: Check failure run: | - if [[ "${{ steps.failing.outcome }}" != "failure" ]]; then + if [[ "${{ steps.faulty_filter.outcome }}" != "failure" ]]; then echo "Test did not fail correctly" exit 1 fi - if [[ "${{ steps.failing.outputs.failure-reason }}" != "no-tests" ]]; then + if [[ "${{ steps.faulty_filter.outputs.failure-reason }}" != "no-tests" ]]; then echo "::error:: failure-reason not set correctly" exit 1 fi diff --git a/image/entrypoints/test.sh b/image/entrypoints/test.sh index 3430eb96..46e22d20 100755 --- a/image/entrypoints/test.sh +++ b/image/entrypoints/test.sh @@ -48,6 +48,7 @@ function test() { if [[ $TEST_EXIT -eq 0 ]]; then # Workaround a bit of stupidity in the terraform test command if grep -q "Success! 0 passed, 0 failed." "$STEP_TMP_DIR/terraform_test.stdout"; then + error_log "No tests found" set_output failure-reason no-tests exit 1 fi