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

Unit-Tests - Add Exit Status #394

Merged
merged 1 commit into from
Jul 2, 2024
Merged

Unit-Tests - Add Exit Status #394

merged 1 commit into from
Jul 2, 2024

Conversation

ASTRobinson
Copy link
Contributor

This PR updates the go-terratest workflow to correctly handle the exit status of the go-test command. Due to the usage of the pipe (|) with redact-output.sh, the exit status of the last command in the pipe is returned, which in this case is the script redact-output.sh. If redact-output.sh does not correctly propagate the exit status of go-test, the workflow is reporting success even when tests fail.

- name: Run Go Tests
  working-directory: test
  run: |
    chmod 700 ../scripts/redact-output.sh
    go test -v | tee >(../scripts/redact-output.sh)
    exit ${PIPESTATUS[0]}

@ASTRobinson ASTRobinson requested a review from a team as a code owner July 2, 2024 10:48
@ASTRobinson ASTRobinson changed the title Pipe Exit Status Unit-Tests - Add Exit Status Jul 2, 2024
@ASTRobinson ASTRobinson merged commit 67caced into main Jul 2, 2024
5 checks passed
@ASTRobinson ASTRobinson deleted the fix/go-terratest branch July 2, 2024 11:14
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-s3-bucket that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-module-template that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-ecs-cluster that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-loadbalancer that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-ssm-patching that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-ec2-instance that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-ec2-autoscaling-group that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-lambda-function that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-baselines that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-cross-account-access that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-iam-superadmins that referenced this pull request Jul 2, 2024
ASTRobinson added a commit to ministryofjustice/modernisation-platform-terraform-member-vpc that referenced this pull request Jul 2, 2024
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