Skip to content

Commit

Permalink
fix: enable pipefail mode for grpcproxy test
Browse files Browse the repository at this point in the history
By default, the pipefail is disabled. For instance, the commands should
return 1 as exit code, but we get zero. After pipefail enabled, it's
back to normal.

```bash
$ ( echo hello; exit 1 ) | tee 2>&1
hello
$ echo $?
0

$ set -o pipefail
$ ( echo hello; exit 122 ) | tee 2>&1
hello
$ echo $?
122
```

And the test.log is used to grep the error from a ton of messages. So
that we should `set +e` and set it back after egrep.

fixes: etcd-io#15487

Signed-off-by: Wei Fu <fuweid89@gmail.com>
  • Loading branch information
fuweid committed Mar 18, 2023
1 parent 2eabc0b commit 91a101a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ jobs:
GO_BUILD_FLAGS='-v' GOARCH=s390x ./build
;;
linux-amd64-grpcproxy)
set -o pipefail; set +e;
PASSES='build grpcproxy' CPU='4' RACE='true' ./test 2>&1 | tee test.log
! egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test.log
ecode=$?
egrep "(--- FAIL:|DATA RACE|panic: test timed out|appears to have leaked)" -B50 -A10 test.log
set -e
exit ${ecode}
;;
linux-386-unit)
GOARCH=386 PASSES='unit' ./test
Expand Down

0 comments on commit 91a101a

Please sign in to comment.