e2e

package
v0.16.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2018 License: MPL-2.0 Imports: 12 Imported by: 0

README

e2e

This package contains all e2e tests divided into subpackages which represents (or should represent) business domains like transactions, chat etc.

These tests are run against public testnets: Ropsten and Rinkeby.

e2e package contains a few utilities which are described in a godoc.

Flags
1. -network

The -network flag is used to provide either a network id or network name which specifies the ethereum network to use for running all test. It by default uses the StatusChain network.

Usage

First of all you need to export an ACCOUNT_PASSWORD environment variable. It should be a passphrase that was used to generate accounts used in tests. If you don't know this variable for default accounts you will have to create your own accounts and request some funds from rinkeby or ropsten faucet. Please see Preparation section for details.

To use the ropsten network for testing using network name:

ACCOUNT_PASSWORD=test go test -v ./t/e2e/... -p=1 -network=ropsten

To use the rinkeby network with chain id 4 for testing:

ACCOUNT_PASSWORD=test go test -v ./t/e2e/... -p=1 -network=4
Preparation

You will need geth in your PATH. Please visit: https://www.ethereum.org/cli. Once installed - generate 2 accounts and remember the passphrase for them, so run this command twice:

geth account new --keystore=static/keys/
Your new account is locked with a password. Please give a password. Do not forget this password.
Passphrase:
Repeat passphrase:
Address: {b6120ddd881593537c2bd4280bae509ec94b1a6b}

We expect that accounts will be named in a certain way:

pushd static/keys/
mv UTC--2018-01-26T13-46-53.657752811Z--b6120ddd881593537c2bd4280bae509ec94b1a6b test-account1.pk
mv UTC--2018-01-26T13-47-49.289567120Z--9f04dc05c4c3ec3b8b1f36f7d7d153f3934b1f07 test-account2.pk
popd

Update config for tests with new accounts t/config/public-chain-accounts.json:

{
  "Account1": {
    "Address": "0xb6120ddd881593537c2bd4280bae509ec94b1a6b"
  },
  "Account2": {
    "Address": "0x9f04dc05c4c3ec3b8b1f36f7d7d153f3934b1f07"
  }
}

Embed keys as a binary data, you will need to install npm tool and web3.js lib:

make generate

As a final step request funds from faucet for a chosen network:

Finally, you are ready to run tests!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstBlockHash

func FirstBlockHash(statusNode *node.StatusNode) (string, error)

FirstBlockHash validates Attach operation for the StatusNode.

Types

type BackendTestSuite

type BackendTestSuite struct {
	suite.Suite
	Backend *api.StatusBackend
}

BackendTestSuite is a test suite with api.StatusBackend initialized and a few utility methods to start and stop node or get various services.

func (*BackendTestSuite) RestartTestNode

func (s *BackendTestSuite) RestartTestNode()

RestartTestNode restarts a currently running node.

func (*BackendTestSuite) SetupTest

func (s *BackendTestSuite) SetupTest()

SetupTest initializes Backend.

func (*BackendTestSuite) StartTestBackend

func (s *BackendTestSuite) StartTestBackend(opts ...TestNodeOption)

StartTestBackend imports some keys and starts a node.

func (*BackendTestSuite) StopTestBackend

func (s *BackendTestSuite) StopTestBackend()

StopTestBackend stops the node.

func (*BackendTestSuite) TearDownTest

func (s *BackendTestSuite) TearDownTest()

TearDownTest cleans up the packages state.

func (*BackendTestSuite) Transactor

func (s *BackendTestSuite) Transactor() *transactions.Transactor

Transactor returns a reference to the Transactor.

func (*BackendTestSuite) WhisperService

func (s *BackendTestSuite) WhisperService() *whisper.Whisper

WhisperService returns a reference to the Whisper service.

type StatusNodeTestSuite

type StatusNodeTestSuite struct {
	suite.Suite
	StatusNode *node.StatusNode
}

StatusNodeTestSuite defines a test suite with StatusNode.

func (*StatusNodeTestSuite) StartTestNode

func (s *StatusNodeTestSuite) StartTestNode(opts ...TestNodeOption)

StartTestNode initiazes a StatusNode instances with configuration retrieved from the test config.

func (*StatusNodeTestSuite) StopTestNode

func (s *StatusNodeTestSuite) StopTestNode()

StopTestNode attempts to stop initialized StatusNode.

type TestNodeOption

type TestNodeOption func(config *params.NodeConfig)

TestNodeOption is a callback passed to StartTestNode which alters its config.

func WithDataDir

func WithDataDir(dataDir string) TestNodeOption

WithDataDir returns TestNodeOption that allows to set another data dir.

func WithUpstream

func WithUpstream(url string) TestNodeOption

WithUpstream returns TestNodeOption which enabled UpstreamConfig.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL