-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(systemtests): Extract system test framework (backport #22578) (
#22655) Co-authored-by: Alexander Peters <alpe@users.noreply.github.com> Co-authored-by: Julien Robert <julien@rbrt.fr>
- Loading branch information
1 parent
26e869e
commit 9402649
Showing
31 changed files
with
735 additions
and
2,876 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/testnet | ||
/binaries | ||
foo/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,48 @@ | ||
# Testing | ||
# System tests | ||
|
||
Test framework for system tests. | ||
Starts and interacts with a (multi node) blockchain in Go. | ||
Supports | ||
Go black box tests that setup and interact with a local blockchain. The system test [framework](../../systemtests) | ||
works with the compiled binary of the chain artifact only. | ||
To get up to speed, checkout the [getting started guide](../../systemtests/getting_started.md). | ||
|
||
* CLI | ||
* Servers | ||
* Events | ||
* RPC | ||
Beside the Go tests and testdata files, this directory can contain the following directories: | ||
|
||
Uses: | ||
* `binaries` - cache for binary | ||
* `testnet` - node files | ||
|
||
* testify | ||
* gjson | ||
* sjson | ||
Please make sure to not add or push them to git. | ||
|
||
Server and client side are executed on the host machine. | ||
## Execution | ||
|
||
## Developer | ||
Build a new binary from current branch and copy it to the `tests/systemtests/binaries` folder by running system tests. | ||
In project root: | ||
|
||
### Test strategy | ||
|
||
System tests cover the full stack via cli and a running (multi node) network. They are more expensive (in terms of time/ cpu) | ||
to run compared to unit or integration tests. | ||
Therefore, we focus on the **critical path** and do not cover every condition. | ||
|
||
## How to use | ||
|
||
Read the [getting_started.md](getting_started.md) guide to get started. | ||
|
||
### Execute a single test | ||
|
||
```sh | ||
go test -tags system_test -count=1 -v . --run TestStakeUnstake -verbose | ||
```shell | ||
make test-system | ||
``` | ||
|
||
Test cli parameters | ||
|
||
* `-verbose` verbose output | ||
* `-wait-time` duration - time to wait for chain events (default 30s) | ||
* `-nodes-count` int - number of nodes in the cluster (default 4) | ||
Or via manual steps | ||
|
||
# Port ranges | ||
```shell | ||
make build | ||
mkdir -p ./tests/systemtests/binaries | ||
cp ./build/simd ./tests/systemtests/binaries/ | ||
``` | ||
|
||
With *n* nodes: | ||
### Manual test run | ||
|
||
* `26657` - `26657+n` - RPC | ||
* `1317` - `1317+n` - API | ||
* `9090` - `9090+n` - GRPC | ||
* `16656` - `16656+n` - P2P | ||
```shell | ||
go test -v -mod=readonly -failfast -tags='system_test' --run TestStakeUnstake ./... --verbose | ||
``` | ||
|
||
For example Node *3* listens on `26660` for RPC calls | ||
### Working with macOS | ||
|
||
## Resources | ||
Most tests should function seamlessly. However, the file [upgrade_test.go](upgrade_test.go) includes a **build annotation** for Linux only. | ||
|
||
* [gjson query syntax](https://github.com/tidwall/gjson#path-syntax) | ||
For the system upgrade test, an older version of the binary is utilized to perform a chain upgrade. This artifact is retrieved from a Docker container built for Linux. | ||
|
||
## Disclaimer | ||
To circumvent this limitation locally: | ||
1. Checkout and build the older version of the artifact from a specific tag for your OS. | ||
2. Place the built artifact into the `binaries` folder. | ||
3. Ensure that the filename, including the version, is correct. | ||
|
||
This is based on the system test framework in [wasmd](https://github.com/CosmWasm/wasmd) built by Confio. | ||
With the cached artifact in place, the test will use this file instead of attempting to pull it from Docker. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.