Add `race-check` target to Makefile. Closes #710 (#769)

* Add `race-check` and `test-unit-race` target to Makefile. Closes #710
This commit is contained in:
Pedro Pombeiro 2018-03-27 14:38:41 +02:00 committed by GitHub
parent 8b264199c9
commit c4d7a6167e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 13 deletions

View File

@ -20,6 +20,7 @@ XGOIMAGE = statusteam/xgo:$(XGOVERSION)
XGOIMAGEIOSSIM = statusteam/xgo-ios-simulator:$(XGOVERSION) XGOIMAGEIOSSIM = statusteam/xgo-ios-simulator:$(XGOVERSION)
networkid ?= StatusChain networkid ?= StatusChain
gotest_extraflags =
DOCKER_IMAGE_NAME ?= statusteam/status-go DOCKER_IMAGE_NAME ?= statusteam/status-go
@ -122,23 +123,29 @@ docker-test: ##@tests Run tests in a docker container with golang.
test: test-unit-coverage ##@tests Run basic, short tests during development test: test-unit-coverage ##@tests Run basic, short tests during development
test-unit: ##@tests Run unit and integration tests test-unit: ##@tests Run unit and integration tests
go test $(UNIT_TEST_PACKAGES) go test $(UNIT_TEST_PACKAGES) $(gotest_extraflags)
test-unit-coverage: ##@tests Run unit and integration tests with coverage test-unit-coverage: ##@tests Run unit and integration tests with coverage
go test -coverpkg= $(UNIT_TEST_PACKAGES) go test -coverpkg= $(UNIT_TEST_PACKAGES) $(gotest_extraflags)
test-unit-race: gotest_extraflags=-race
test-unit-race: test-unit ##@tests Run unit and integration tests with -race flag
test-e2e: ##@tests Run e2e tests test-e2e: ##@tests Run e2e tests
# order: reliability then alphabetical # order: reliability then alphabetical
# TODO(tiabc): make a single command out of them adding `-p 1` flag. # TODO(tiabc): make a single command out of them adding `-p 1` flag.
go test -timeout 5m ./t/e2e/accounts/... -network=$(networkid) go test -timeout 5m ./t/e2e/accounts/... -network=$(networkid) $(gotest_extraflags)
go test -timeout 5m ./t/e2e/api/... -network=$(networkid) go test -timeout 5m ./t/e2e/api/... -network=$(networkid) $(gotest_extraflags)
go test -timeout 5m ./t/e2e/node/... -network=$(networkid) go test -timeout 5m ./t/e2e/node/... -network=$(networkid) $(gotest_extraflags)
go test -timeout 50m ./t/e2e/jail/... -network=$(networkid) go test -timeout 50m ./t/e2e/jail/... -network=$(networkid) $(gotest_extraflags)
go test -timeout 20m ./t/e2e/rpc/... -network=$(networkid) go test -timeout 20m ./t/e2e/rpc/... -network=$(networkid) $(gotest_extraflags)
go test -timeout 20m ./t/e2e/whisper/... -network=$(networkid) go test -timeout 20m ./t/e2e/whisper/... -network=$(networkid) $(gotest_extraflags)
go test -timeout 10m ./t/e2e/transactions/... -network=$(networkid) go test -timeout 10m ./t/e2e/transactions/... -network=$(networkid) $(gotest_extraflags)
# e2e_test tag is required to include some files from ./lib without _test suffix # e2e_test tag is required to include some files from ./lib without _test suffix
go test -timeout 40m -tags e2e_test ./lib -network=$(networkid) go test -timeout 40m -tags e2e_test ./lib -network=$(networkid) $(gotest_extraflags)
race-check: gotest_extraflags=-race
race-check: test-e2e ##@tests Run e2e tests with -race flag
lint-install: lint-install:
go get -u github.com/alecthomas/gometalinter go get -u github.com/alecthomas/gometalinter

View File

@ -270,7 +270,7 @@ var loadConfigTestCases = []struct {
require.True(t, nodeConfig.ClusterConfig.Enabled, "cluster configuration is expected to be enabled after loading file") require.True(t, nodeConfig.ClusterConfig.Enabled, "cluster configuration is expected to be enabled after loading file")
enodes := nodeConfig.ClusterConfig.StaticNodes enodes := nodeConfig.ClusterConfig.StaticNodes
require.True(t, len(enodes) == 2) require.Len(t, enodes, 2)
}, },
}, },
{ {

View File

@ -79,11 +79,11 @@ func (s *WhisperMailboxSuite) TestRequestMessageFromMailboxAsync() {
//Create message filter //Create message filter
messageFilterID := s.createPrivateChatMessageFilter(rpcClient, keyID, topic.String()) messageFilterID := s.createPrivateChatMessageFilter(rpcClient, keyID, topic.String())
//Threre are no messages at filter //There are no messages at filter
messages := s.getMessagesByMessageFilterID(rpcClient, messageFilterID) messages := s.getMessagesByMessageFilterID(rpcClient, messageFilterID)
s.Require().Equal(0, len(messages)) s.Require().Equal(0, len(messages))
//Post message matching with filter (key and token) //Post message matching with filter (key and topic)
s.postMessageToPrivate(rpcClient, pubkey.String(), topic.String(), hexutil.Encode([]byte("Hello world!"))) s.postMessageToPrivate(rpcClient, pubkey.String(), topic.String(), hexutil.Encode([]byte("Hello world!")))
//Get message to make sure that it will come from the mailbox later //Get message to make sure that it will come from the mailbox later