Group tests in a dedicated testing package (#629)
This commit is contained in:
parent
766568dc11
commit
70912ab8f6
16
Makefile
16
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)
|
||||
|
||||
|
|
|
@ -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:
|
||||
```
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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.
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -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)
|
|
@ -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"
|
||||
)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package testing
|
||||
package utils
|
||||
|
||||
import (
|
||||
"bytes"
|
Loading…
Reference in New Issue