bfenetworks / bfe

A modern layer 7 load balancer from baidu
https://www.bfe-networks.net
Apache License 2.0
6.12k stars 945 forks source link

Can't run bfe_spdy/frame_test.go tests: call to (*T).Fatal from a non-test goroutine #719

Closed advancedwebdeveloper closed 3 years ago

advancedwebdeveloper commented 3 years ago

Hello.

coverage: 84.7% of statements ok github.com/bfenetworks/bfe/bfe_websocket (cached) coverage: 84.7% of statements go vet ./...

github.com/bfenetworks/bfe/bfe_spdy

bfe_spdy/frame_test.go:541:4: call to (T).Fatal from a non-test goroutine bfe_spdy/frame_test.go:544:4: call to (T).Fatal from a non-test goroutine

I had to do some small modifications:

$ git diff diff --git a/Makefile b/Makefile index 130782f7..20e98ae3 100644 --- a/Makefile --- a/Makefile diff --git a/Makefile b/Makefile index 130782f7..20e98ae3 100644 --- a/Makefile diff --git a/Makefile b/Makefile index 130782f7..20e98ae3 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ export GO111MODULE := on

init command params

GO := go GOBUILD := $(GO) build -GOTEST := $(GO) test +GOTEST := $(GO) test -v -x GOVET := $(GO) vet GOGET := $(GO) get GOGEN := $(GO) generate diff --git a/go.mod b/go.mod index a5612e48..a2801c9d 100644 --- a/go.mod +++ b/go.mod

~/bfe$ go version go version go1.16.2 linux/arm64 ~/bfe$ go env GO111MODULE="" GOARCH="arm64" GOBIN="" GOCACHE="/home/oceanfish81/.cache/go-build" GOENV="/home/oceanfish81/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/oceanfish81/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/oceanfish81/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_arm64" GOVCS="" GOVERSION="go1.16.2" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/oceanfish81/bfe/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1196197460=/tmp/go-build -gno-record-gcc-switches" ~/bfe$ uname -a Linux ams1-c1-large-arm-01 5.4.0-40-generic #44-Ubuntu SMP Mon Jun 22 23:59:48 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

CC @ianlancetaylor , in case if I could advise something

ianlancetaylor commented 3 years ago

It's incorrect to call t.Fatal from a goroutine started by a test, as documented at https://golang.org/pkg/testing/#T.FailNow (t.Fatal calls t.FailNow, as documented at https://golang.org/pkg/testing/#T.Fatal). So the vet error is correct and the code in bfe_spdy/frame_test.go should be changed.

iyangsj commented 3 years ago

Thanks for your feedback! We will fix it soon.

iyangsj commented 3 years ago

The issue is resolved by #721