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

fail the test-example.sh if go test fail, but after post.sh got executed #92

Merged
merged 1 commit into from
Mar 7, 2025

Conversation

lonegunmanb
Copy link
Member

No description provided.

Copy link
Member

@jaredfholgate jaredfholgate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a couple of questions that show my limited bash knowledge. :)

@@ -28,7 +28,8 @@ fi
echo "==> go test"
echo $TEST_TIMEOUT
terraform version
go test -v -timeout=$TEST_TIMEOUT -run TestExample --
test_failed=false
go test -v -timeout=$TEST_TIMEOUT -run TestExample || test_failed=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was -- doing before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is a mistake.

@@ -28,7 +28,8 @@ fi
echo "==> go test"
echo $TEST_TIMEOUT
terraform version
go test -v -timeout=$TEST_TIMEOUT -run TestExample --
test_failed=false
go test -v -timeout=$TEST_TIMEOUT -run TestExample || test_failed=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will go test return a none 0 exit code if it fails? Is that how this will work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, once go test failed we'll set test_failed to true, then return 1 finally.

@lonegunmanb lonegunmanb merged commit d81ce6a into main Mar 7, 2025
3 checks passed
@lonegunmanb lonegunmanb deleted the fail-test branch March 7, 2025 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants