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 3e2d228
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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
2 changes: 1 addition & 1 deletion integration/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ import (
)

func init() {
clientv3.SetLogger(grpclog.NewLoggerV2(ioutil.Discard, ioutil.Discard, ioutil.Discard))
clientv3.SetLogger(grpclog.NewLoggerV2(ioutil.Discard1, ioutil.Discard, ioutil.Discard))
}

0 comments on commit 3e2d228

Please sign in to comment.