package
0.28.0
Repository: https://github.com/ten-protocol/go-ten.git
Documentation: pkg.go.dev

# README

Network test

Network tests provide standard structures for running functional, load and scenario tests against a network.

They are designed to be network agnostic, able to run against both local dev networks and remote testnets.

Actions

Tests are structured using "Actions" which can be run in series of parallel in a nested tree down to very small steps.

Action's Run() method takes a context and a network connector, it returns a context and potential error.

Actions can use the context to pass values to tests that are running later in the flow, so properties that an action require from the context are part of that action's API. We use the ActionKey type for the context keys.

Running tests

All tests can be found under the /tests directory. They are grouped into a few packages to try to keep similarly used tests together.

/helpful

These are ad-hoc helpers, for example:

  • running a local network indefinitely
  • smoke test that checks a network isn't completely broken

/load

These tests are designed to apply simulated user activity for a period of time to stress the network.

/nodescenario

These tests require a network that provides access to its nodes through the NodeOperator interface.

They can be used to test scenarios such as rejoining the network after a restart, sequencer failover, nodes losing connectivity.

/ci

These are the only tests that will run during the CI builds by default, they should be quick and not fragile.

UserWallet

In /userwallet is a high-level client that bundles a simulated user's private key, an RPC client and manages the nonce and viewing key.

It aims to make testing easier by mimicking the functionality of software and hardware wallets in the real world (a high-level interface for interacting with the crypto chain for a user's account(s))

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

EnsureTestLogsSetUp calls Setup if it hasn't already been called (some tests run tests within themselves, we don't want the log folder flipping around for every subtest, so we assume this is called for the top level test that is running and ignore subsequent calls.
No description provided by the author
Run provides a standardised way to run tests and provides a single place for changing logging/output styles, etc.
No description provided by the author

# Constants

IDEFlag is used as an environnment variable to allow tests to run that are designed not to run in CI todo (@matt) - come up with a better method, perhaps using directory-based ignore/include mechanism for `ci` dir only.
No description provided by the author

# Interfaces

Action is any step in a test, they will typically be either minimally small steps in the test or they will be containers that coordinate the running of multiple sub-actions (e.g.
Environment abstraction allows the test runner to prepare the network connector with optional config and steps and to handle the clean-up so that different types of NetworkConnector can be configured in the same style (see runner.go) (local network requires setup and teardown for example, whereas a connector to a Testnet is ready to go).
NetworkConnector represents the network being tested against, e.g.
NodeOperator is used by the DevNetwork for orchestrating different scenarios It attempts to encapsulate the data, monitoring and possible actions that would be available to a real NodeOperator in a live permissionless Obscuro network.