package
0.0.0-20230112070230-96587e205e3a
Repository: https://github.com/harbinger-network/furya.git
Documentation: pkg.go.dev

# README

Testing

Test framework for system tests. Starts and interacts with a (multi node) blockchain in Go. Supports

  • CLI
  • Servers
  • Events
  • RPC

Uses:

  • testify
  • gjson
  • sjson Server and client side are executed on the host machine

Developer

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.

Execute a single test

go test -tags system_test -count=1 -v ./testing --run TestSmokeTest  -verbose
  • Force a binary rebuild before running the test
go test -tags system_test -count=1 -v ./testing --run TestSmokeTest  -verbose -rebuild

Test cli parameters

  • -verbose verbose output
  • -rebuild - rebuild artifacts
  • -wait-time duration - time to wait for chain events (default 30s)
  • -nodes-count int - number of nodes in the cluster (default 4)

Port ranges

With n nodes:

  • 26657 - 26657+n - RPC
  • 1317 - 1317+n - API
  • 9090 - 9090+n - GRPC
  • 16656 - 16656+n - P2P

For example Node 3 listens on 26660 for RPC calls

Resources

Disclaimer

This was inspired by the amazing work of the e-money team on their system tests. Thank you!

# Packages

No description provided by the author

# Functions

CaptureAllEventsConsumer is an `EventConsumer` that captures all events until `done()` is called to stop or timeout happens.
CaptureSingleEventConsumer consumes one event.
NewEventListener event listener.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RequireTxFailure require the received response to contain any failure code and the passed msgsgs.
RequireTxSuccess require the received response to contain the success code.
SetAllEngagementPoints set the given value for all members of the engagement group (default = validators).
SetBlockRewards set the valset contract config unbonding period.
SetConsensusMaxGas max gas that can be consumed in a block.
SetEpochLength set the valset contract config to given epoch length.
SetGlobalMinFee set the passed coins to the global minimum fee.
SetPoEParamsMutator set params in genesis.
SetUnbondingPeriod set the stake contract config unbonding period.
TimeoutConsumer is an event consumer decorator with a max wait time.

# Variables

ErrInvalidQuery requires smart query request failed.
ErrOutOfGasMatcher requires error with out of gas message.
ErrPostFailedMatcher requires post failed.
ErrTimeoutMatcher requires time out message.

# Structs

EventListener watches for events on the chain.
No description provided by the author
RPCClient is a test helper to interact with a node via the RPC endpoint.
SystemUnderTest blockchain provisioning.
TgradeCli wraps the command line interface.

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
RunErrorAssert is custom type that is satisfies by testify matchers as well.