Skip to content

Commit

Permalink
Merge pull request #569 from uber/lu.test
Browse files Browse the repository at this point in the history
Turn on race detector for tests
  • Loading branch information
ChuntaoLu committed Mar 20, 2019
2 parents 907a1bc + 0db9c7d commit a14c805
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,13 @@ test: generate lint
test-only:
@rm -f ./test/.cached_binary_test_info.json
@echo "Running all tests..."
@ZANZIBAR_CACHE=1 go test ./test/health_test.go # preload the binary cache
@PATH=$(PATH):$(GOIMPORTS) ZANZIBAR_CACHE=1 go test \
@ZANZIBAR_CACHE=1 go test -race ./test/health_test.go # preload the binary cache
@PATH=$(PATH):$(GOIMPORTS) ZANZIBAR_CACHE=1 go test -race \
./examples/example-gateway/... \
./codegen/... \
./runtime/... \
./test/... | \
./runtime/... | \
grep -v '\[no test files\]'
@PATH=$(PATH):$(GOIMPORTS) ZANZIBAR_CACHE=1 go test ./test/... | \
grep -v '\[no test files\]'
@rm -f ./test/.cached_binary_test_info.json
@echo "<coverage />" > ./coverage/cobertura-coverage.xml
Expand Down
6 changes: 6 additions & 0 deletions runtime/client_http_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ var defaultTestOptions *testGateway.Options = &testGateway.Options{
}
var defaultTestConfig map[string]interface{} = map[string]interface{}{
"clients.baz.serviceName": "baz",

// disable circuit breaker to avoid race condition when running tests
// the circuit breaker lib emits metrics in a free goroutine, when the
// server closes, it attempts to close the channel for emitting metrics
// but the circuit breaker stats report goroutine could still be running
"clients.bar.circuitBreakerDisabled": true,
}

func TestMakingClientWriteJSONWithBadJSON(t *testing.T) {
Expand Down

0 comments on commit a14c805

Please sign in to comment.