diff --git a/Makefile b/Makefile index eb8675795..e05125f51 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ XGOIMAGEIOSSIM = statusteam/xgo-ios-simulator:$(XGOVERSION) DOCKER_IMAGE_NAME ?= status-go -UNIT_TEST_PACKAGES := $(shell go list ./... | grep -v /vendor | grep -v /e2e | grep -v /cmd | grep -v /lib) +UNIT_TEST_PACKAGES := $(shell go list ./... | grep -v /vendor | grep -v /t/e2e | grep -v /cmd | grep -v /lib) # This is a code for automatic help generator. # It supports ANSI colors and categories. @@ -126,13 +126,13 @@ test-unit-coverage: ##@tests Run unit and integration tests with coverage test-e2e: ##@tests Run e2e tests # order: reliability then alphabetical # TODO(tiabc): make a single command out of them adding `-p 1` flag. - go test -timeout 5m ./e2e/accounts/... -network=$(networkid) - go test -timeout 5m ./e2e/api/... -network=$(networkid) - go test -timeout 5m ./e2e/node/... -network=$(networkid) - go test -timeout 50m ./e2e/jail/... -network=$(networkid) - go test -timeout 20m ./e2e/rpc/... -network=$(networkid) - go test -timeout 20m ./e2e/whisper/... -network=$(networkid) - go test -timeout 10m ./e2e/transactions/... -network=$(networkid) + go test -timeout 5m ./t/e2e/accounts/... -network=$(networkid) + go test -timeout 5m ./t/e2e/api/... -network=$(networkid) + go test -timeout 5m ./t/e2e/node/... -network=$(networkid) + go test -timeout 50m ./t/e2e/jail/... -network=$(networkid) + go test -timeout 20m ./t/e2e/rpc/... -network=$(networkid) + go test -timeout 20m ./t/e2e/whisper/... -network=$(networkid) + go test -timeout 10m ./t/e2e/transactions/... -network=$(networkid) # e2e_test tag is required to include some files from ./lib without _test suffix go test -timeout 40m -tags e2e_test ./lib -network=$(networkid) diff --git a/README.md b/README.md index 06269cebd..f94b05009 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ To test statusgo using a given network by number ID, use: make ci networkid=3 ``` -If you have problems running tests on public network we suggest reading [e2e guide](e2e/README.md). +If you have problems running tests on public network we suggest reading [e2e guide](t/e2e/README.md). If you want to launch specific test, for instance `RPCSendTransactions`, use the following command: ``` diff --git a/geth/account/accounts_test.go b/geth/account/accounts_test.go index 345eba4bb..26e0142db 100644 --- a/geth/account/accounts_test.go +++ b/geth/account/accounts_test.go @@ -15,7 +15,7 @@ import ( whisper "github.com/ethereum/go-ethereum/whisper/whisperv5" "github.com/golang/mock/gomock" "github.com/status-im/status-go/geth/common" - . "github.com/status-im/status-go/testing" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" ) diff --git a/geth/transactions/txqueue_manager_test.go b/geth/transactions/txqueue_manager_test.go index 5c5497bd9..13fc9a4b6 100644 --- a/geth/transactions/txqueue_manager_test.go +++ b/geth/transactions/txqueue_manager_test.go @@ -23,7 +23,7 @@ import ( "github.com/status-im/status-go/geth/rpc" "github.com/status-im/status-go/geth/transactions/fake" "github.com/status-im/status-go/geth/transactions/queue" - . "github.com/status-im/status-go/testing" + . "github.com/status-im/status-go/t/utils" ) func TestTxQueueTestSuite(t *testing.T) { diff --git a/lib/utils.go b/lib/utils.go index cbcde4254..5ca762d54 100644 --- a/lib/utils.go +++ b/lib/utils.go @@ -37,7 +37,7 @@ import ( "github.com/status-im/status-go/geth/transactions" "github.com/status-im/status-go/geth/transactions/queue" "github.com/status-im/status-go/static" - . "github.com/status-im/status-go/testing" //nolint: golint + . "github.com/status-im/status-go/t/utils" //nolint: golint ) const zeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000" diff --git a/e2e/README.md b/t/e2e/README.md similarity index 92% rename from e2e/README.md rename to t/e2e/README.md index 28da14e67..796c72cab 100644 --- a/e2e/README.md +++ b/t/e2e/README.md @@ -5,7 +5,7 @@ This package contains all e2e tests divided into subpackages which represents (o These tests are run against public testnets: Ropsten and Rinkeby. -e2e package contains a few utilities which are described in a [godoc](https://godoc.org/github.com/status-im/status-go/e2e). +e2e package contains a few utilities which are described in a [godoc](https://godoc.org/github.com/status-im/status-go/t/e2e). ### Flags @@ -23,13 +23,13 @@ Please see Preparation section for details. To use the `ropsten` network for testing using network name: ```bash -ACCOUNT_PASSWORD=test go test -v ./e2e/... -p= 1 -network=ropsten +ACCOUNT_PASSWORD=test go test -v ./t/e2e/... -p=1 -network=ropsten ``` To use the `rinkeby` network with chain id `4` for testing: ```bash -ACCOUNT_PASSWORD=test go test -v ./e2e/... -p=1 -network=4 +ACCOUNT_PASSWORD=test go test -v ./t/e2e/... -p=1 -network=4 ``` #### Preparation diff --git a/e2e/accounts/accounts_rpc_test.go b/t/e2e/accounts/accounts_rpc_test.go similarity index 94% rename from e2e/accounts/accounts_rpc_test.go rename to t/e2e/accounts/accounts_rpc_test.go index 2ec81cbaf..7be15a424 100644 --- a/e2e/accounts/accounts_rpc_test.go +++ b/t/e2e/accounts/accounts_rpc_test.go @@ -4,9 +4,9 @@ import ( "strings" "testing" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/params" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) diff --git a/e2e/accounts/accounts_test.go b/t/e2e/accounts/accounts_test.go similarity index 99% rename from e2e/accounts/accounts_test.go rename to t/e2e/accounts/accounts_test.go index 6c11dfd26..4aa673ee9 100644 --- a/e2e/accounts/accounts_test.go +++ b/t/e2e/accounts/accounts_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/account" "github.com/status-im/status-go/geth/common" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) diff --git a/e2e/api/api_test.go b/t/e2e/api/api_test.go similarity index 98% rename from e2e/api/api_test.go rename to t/e2e/api/api_test.go index d8ea6d0f2..02b2c08e8 100644 --- a/e2e/api/api_test.go +++ b/t/e2e/api/api_test.go @@ -8,11 +8,11 @@ import ( "testing" "time" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/api" "github.com/status-im/status-go/geth/log" "github.com/status-im/status-go/geth/params" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) diff --git a/e2e/api/backend_test.go b/t/e2e/api/backend_test.go similarity index 99% rename from e2e/api/backend_test.go rename to t/e2e/api/backend_test.go index 16488ed92..0decdb031 100644 --- a/e2e/api/backend_test.go +++ b/t/e2e/api/backend_test.go @@ -5,14 +5,14 @@ import ( "testing" "time" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/account" "github.com/status-im/status-go/geth/common" "github.com/status-im/status-go/geth/jail" "github.com/status-im/status-go/geth/log" "github.com/status-im/status-go/geth/node" "github.com/status-im/status-go/geth/params" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) diff --git a/e2e/jail/jail_rpc_test.go b/t/e2e/jail/jail_rpc_test.go similarity index 99% rename from e2e/jail/jail_rpc_test.go rename to t/e2e/jail/jail_rpc_test.go index cc3a02e23..c58cc957a 100644 --- a/e2e/jail/jail_rpc_test.go +++ b/t/e2e/jail/jail_rpc_test.go @@ -10,12 +10,12 @@ import ( "time" gethcommon "github.com/ethereum/go-ethereum/common" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/common" "github.com/status-im/status-go/geth/params" "github.com/status-im/status-go/geth/signal" "github.com/status-im/status-go/geth/transactions" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) diff --git a/e2e/jail/jail_test.go b/t/e2e/jail/jail_test.go similarity index 99% rename from e2e/jail/jail_test.go rename to t/e2e/jail/jail_test.go index ed38a5b18..810ae48ca 100644 --- a/e2e/jail/jail_test.go +++ b/t/e2e/jail/jail_test.go @@ -10,12 +10,12 @@ import ( "testing" "time" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/common" "github.com/status-im/status-go/geth/jail" "github.com/status-im/status-go/geth/node" "github.com/status-im/status-go/geth/signal" "github.com/status-im/status-go/static" + e2e "github.com/status-im/status-go/t/e2e" "github.com/stretchr/testify/suite" ) diff --git a/e2e/node/manager_test.go b/t/e2e/node/manager_test.go similarity index 99% rename from e2e/node/manager_test.go rename to t/e2e/node/manager_test.go index fed4dd709..66ab74ea3 100644 --- a/e2e/node/manager_test.go +++ b/t/e2e/node/manager_test.go @@ -11,11 +11,11 @@ import ( gethnode "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/rpc" whisper "github.com/ethereum/go-ethereum/whisper/whisperv5" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/node" "github.com/status-im/status-go/geth/params" "github.com/status-im/status-go/geth/signal" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) diff --git a/e2e/rpc/client_test.go b/t/e2e/rpc/client_test.go similarity index 91% rename from e2e/rpc/client_test.go rename to t/e2e/rpc/client_test.go index 9e90ff51e..254cf88e4 100644 --- a/e2e/rpc/client_test.go +++ b/t/e2e/rpc/client_test.go @@ -3,10 +3,10 @@ package rpc import ( "testing" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/node" "github.com/status-im/status-go/geth/rpc" - . "github.com/status-im/status-go/testing" //nolint: golint + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" //nolint: golint "github.com/stretchr/testify/suite" ) diff --git a/e2e/rpc/rpc_test.go b/t/e2e/rpc/rpc_test.go similarity index 98% rename from e2e/rpc/rpc_test.go rename to t/e2e/rpc/rpc_test.go index 1b7e31f8a..8e5c8cbb5 100644 --- a/e2e/rpc/rpc_test.go +++ b/t/e2e/rpc/rpc_test.go @@ -10,10 +10,10 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/node" "github.com/status-im/status-go/geth/params" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) diff --git a/e2e/suites.go b/t/e2e/suites.go similarity index 98% rename from e2e/suites.go rename to t/e2e/suites.go index 2b1bb17bf..0529762b4 100644 --- a/e2e/suites.go +++ b/t/e2e/suites.go @@ -1,4 +1,4 @@ -package e2e +package t import ( "github.com/ethereum/go-ethereum/les" @@ -8,7 +8,7 @@ import ( "github.com/status-im/status-go/geth/log" "github.com/status-im/status-go/geth/signal" "github.com/status-im/status-go/geth/transactions" - . "github.com/status-im/status-go/testing" //nolint: golint + . "github.com/status-im/status-go/t/utils" //nolint: golint "github.com/stretchr/testify/suite" ) diff --git a/e2e/testing.go b/t/e2e/testing.go similarity index 96% rename from e2e/testing.go rename to t/e2e/testing.go index 6f49a8ff6..1352e7e47 100644 --- a/e2e/testing.go +++ b/t/e2e/testing.go @@ -1,4 +1,4 @@ -package e2e +package t import ( "context" @@ -10,7 +10,7 @@ import ( gethcommon "github.com/ethereum/go-ethereum/common" "github.com/status-im/status-go/geth/common" "github.com/status-im/status-go/geth/params" - . "github.com/status-im/status-go/testing" //nolint: golint + . "github.com/status-im/status-go/t/utils" //nolint: golint ) // TestNodeOption is a callback passed to StartTestNode which alters its config. diff --git a/e2e/transactions/transactions_test.go b/t/e2e/transactions/transactions_test.go similarity index 99% rename from e2e/transactions/transactions_test.go rename to t/e2e/transactions/transactions_test.go index 2259fa355..127b23e36 100644 --- a/e2e/transactions/transactions_test.go +++ b/t/e2e/transactions/transactions_test.go @@ -14,14 +14,14 @@ import ( gethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/log" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/account" "github.com/status-im/status-go/geth/common" "github.com/status-im/status-go/geth/params" "github.com/status-im/status-go/geth/signal" "github.com/status-im/status-go/geth/transactions" "github.com/status-im/status-go/geth/transactions/queue" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) diff --git a/e2e/whisper/mailservice_test.go b/t/e2e/whisper/mailservice_test.go similarity index 97% rename from e2e/whisper/mailservice_test.go rename to t/e2e/whisper/mailservice_test.go index bb439e092..8768dce07 100644 --- a/e2e/whisper/mailservice_test.go +++ b/t/e2e/whisper/mailservice_test.go @@ -6,9 +6,9 @@ import ( "net/http" "testing" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/node" "github.com/status-im/status-go/geth/params" + e2e "github.com/status-im/status-go/t/e2e" "github.com/stretchr/testify/suite" ) diff --git a/e2e/whisper/whisper_jail_test.go b/t/e2e/whisper/whisper_jail_test.go similarity index 98% rename from e2e/whisper/whisper_jail_test.go rename to t/e2e/whisper/whisper_jail_test.go index 56847a5cc..336aac234 100644 --- a/e2e/whisper/whisper_jail_test.go +++ b/t/e2e/whisper/whisper_jail_test.go @@ -6,10 +6,10 @@ import ( "github.com/ethereum/go-ethereum/crypto" whisper "github.com/ethereum/go-ethereum/whisper/whisperv5" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/common" "github.com/status-im/status-go/static" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) diff --git a/e2e/whisper/whisper_mailbox_test.go b/t/e2e/whisper/whisper_mailbox_test.go similarity index 96% rename from e2e/whisper/whisper_mailbox_test.go rename to t/e2e/whisper/whisper_mailbox_test.go index 7295afcd3..21ddcc395 100644 --- a/e2e/whisper/whisper_mailbox_test.go +++ b/t/e2e/whisper/whisper_mailbox_test.go @@ -2,6 +2,7 @@ package whisper import ( "encoding/json" + "path/filepath" "strconv" "testing" "time" @@ -12,10 +13,10 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/whisper/whisperv5" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/api" "github.com/status-im/status-go/geth/rpc" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) @@ -305,7 +306,7 @@ func (d *groupChatParams) Encode() (string, error) { //Start status node func (s *WhisperMailboxSuite) startBackend(name string) (*api.StatusBackend, func()) { - datadir := "../../.ethereumtest/mailbox/" + name + datadir := filepath.Join(RootDir, ".ethereumtest/mailbox", name) backend := api.NewStatusBackend() nodeConfig, err := e2e.MakeTestNodeConfig(GetNetworkID()) nodeConfig.DataDir = datadir @@ -332,15 +333,15 @@ func (s *WhisperMailboxSuite) startMailboxBackend() (*api.StatusBackend, func()) mailboxBackend := api.NewStatusBackend() mailboxConfig, err := e2e.MakeTestNodeConfig(GetNetworkID()) s.Require().NoError(err) - datadir := "../../.ethereumtest/mailbox/mailserver/" + datadir := filepath.Join(RootDir, ".ethereumtest/mailbox/mailserver") mailboxConfig.LightEthConfig.Enabled = false mailboxConfig.WhisperConfig.Enabled = true - mailboxConfig.KeyStoreDir = "../../.ethereumtest/mailbox/mailserver" + mailboxConfig.KeyStoreDir = datadir mailboxConfig.WhisperConfig.EnableMailServer = true - mailboxConfig.WhisperConfig.IdentityFile = "../../static/keys/wnodekey" - mailboxConfig.WhisperConfig.PasswordFile = "../../static/keys/wnodepassword" - mailboxConfig.WhisperConfig.DataDir = "../../.ethereumtest/mailbox/mailserver/data" + mailboxConfig.WhisperConfig.IdentityFile = filepath.Join(RootDir, "/static/keys/wnodekey") + mailboxConfig.WhisperConfig.PasswordFile = filepath.Join(RootDir, "/static/keys/wnodepassword") + mailboxConfig.WhisperConfig.DataDir = filepath.Join(datadir, "data") mailboxConfig.DataDir = datadir mailboxNodeStarted, err := mailboxBackend.StartNode(mailboxConfig) diff --git a/e2e/whisper/whisper_test.go b/t/e2e/whisper/whisper_test.go similarity index 97% rename from e2e/whisper/whisper_test.go rename to t/e2e/whisper/whisper_test.go index c304487f2..6cda8c3e2 100644 --- a/e2e/whisper/whisper_test.go +++ b/t/e2e/whisper/whisper_test.go @@ -6,10 +6,10 @@ import ( "github.com/ethereum/go-ethereum/crypto" whisper "github.com/ethereum/go-ethereum/whisper/whisperv5" - "github.com/status-im/status-go/e2e" "github.com/status-im/status-go/geth/account" "github.com/status-im/status-go/geth/node" - . "github.com/status-im/status-go/testing" + e2e "github.com/status-im/status-go/t/e2e" + . "github.com/status-im/status-go/t/utils" "github.com/stretchr/testify/suite" ) diff --git a/testing/testing.go b/t/utils/utils.go similarity index 99% rename from testing/testing.go rename to t/utils/utils.go index fbf3c5083..782e0764e 100644 --- a/testing/testing.go +++ b/t/utils/utils.go @@ -1,4 +1,4 @@ -package testing +package utils import ( "bytes"