Some checks failed
Build SimApp / build (amd64) (push) Waiting to run
Build SimApp / build (arm64) (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Build & Push / build (push) Waiting to run
Run Gosec / Gosec (push) Waiting to run
Lint / golangci-lint (push) Waiting to run
Checks dependencies and mocks generation / Check go mod tidy (push) Waiting to run
Checks dependencies and mocks generation / Check up to date mocks (push) Waiting to run
System Tests / setup (push) Waiting to run
System Tests / test-system (push) Blocked by required conditions
System Tests / test-system-legacy (push) Blocked by required conditions
Tests / Code Coverage / split-test-files (push) Waiting to run
Tests / Code Coverage / tests (00) (push) Blocked by required conditions
Tests / Code Coverage / tests (01) (push) Blocked by required conditions
Tests / Code Coverage / tests (02) (push) Blocked by required conditions
Tests / Code Coverage / tests (03) (push) Blocked by required conditions
Tests / Code Coverage / test-integration (push) Waiting to run
Tests / Code Coverage / test-e2e (push) Waiting to run
Tests / Code Coverage / repo-analysis (push) Blocked by required conditions
Tests / Code Coverage / test-sim-nondeterminism (push) Waiting to run
Tests / Code Coverage / test-clientv2 (push) Waiting to run
Tests / Code Coverage / test-core (push) Waiting to run
Tests / Code Coverage / test-depinject (push) Waiting to run
Tests / Code Coverage / test-errors (push) Waiting to run
Tests / Code Coverage / test-math (push) Waiting to run
Tests / Code Coverage / test-schema (push) Waiting to run
Tests / Code Coverage / test-collections (push) Waiting to run
Tests / Code Coverage / test-cosmovisor (push) Waiting to run
Tests / Code Coverage / test-confix (push) Waiting to run
Tests / Code Coverage / test-store (push) Waiting to run
Tests / Code Coverage / test-log (push) Waiting to run
Tests / Code Coverage / test-x-tx (push) Waiting to run
Tests / Code Coverage / test-x-nft (push) Waiting to run
Tests / Code Coverage / test-x-circuit (push) Waiting to run
Tests / Code Coverage / test-x-feegrant (push) Waiting to run
Tests / Code Coverage / test-x-evidence (push) Waiting to run
Tests / Code Coverage / test-x-upgrade (push) Waiting to run
Tests / Code Coverage / test-tools-benchmark (push) Waiting to run
Build & Push SDK Proto Builder / build (push) Has been cancelled
66 lines
2.2 KiB
Go
66 lines
2.2 KiB
Go
/*
|
|
Package network implements and exposes a fully operational in-process CometBFT
|
|
test network that consists of at least one or potentially many validators. This
|
|
test network can be used primarily for integration tests or unit test suites.
|
|
|
|
The test network utilizes SimApp as the ABCI application and uses all the modules
|
|
defined in the Cosmos SDK. An in-process test network can be configured with any
|
|
number of validators as well as account funds and even custom genesis state.
|
|
|
|
When creating a test network, a series of Validator objects are returned. Each
|
|
Validator object has useful information such as their address and public key. A
|
|
Validator will also provide its RPC, P2P, and API addresses that can be useful
|
|
for integration testing. In addition, a CometBFT local RPC client is also provided
|
|
which can be handy for making direct RPC calls to CometBFT.
|
|
|
|
Note, due to limitations in concurrency and the design of the RPC layer in
|
|
CometBFT, only the first Validator object will have an RPC and API client
|
|
exposed. Due to this exact same limitation, only a single test network can exist
|
|
at a time. A caller must be certain it calls Cleanup after it no longer needs
|
|
the network.
|
|
|
|
A typical testing flow might look like the following:
|
|
|
|
type IntegrationTestSuite struct {
|
|
suite.Suite
|
|
|
|
cfg network.Config
|
|
network *network.Network
|
|
}
|
|
|
|
func (s *IntegrationTestSuite) SetupSuite() {
|
|
s.T().Log("setting up integration test suite")
|
|
|
|
cfg := network.DefaultConfig()
|
|
cfg.NumValidators = 1
|
|
s.cfg = cfg
|
|
|
|
var err error
|
|
s.network, err = network.New(s.T(), s.T().TempDir(), cfg)
|
|
s.Require().NoError(err)
|
|
|
|
s.Require().NoError(s.network.WaitForNextBlock())
|
|
}
|
|
|
|
func (s *IntegrationTestSuite) TearDownSuite() {
|
|
s.T().Log("tearing down integration test suite")
|
|
|
|
// This is important and must be called to ensure other tests can create
|
|
// a network!
|
|
s.network.Cleanup()
|
|
}
|
|
|
|
func (s *IntegrationTestSuite) TestQueryBalancesRequestHandlerFn() {
|
|
val := s.network.Validators[0]
|
|
baseURL := val.APIAddress
|
|
|
|
// Use baseURL to make API HTTP requests or use val.RPCClient to make direct
|
|
// CometBFT RPC calls.
|
|
// ...
|
|
}
|
|
|
|
func TestIntegrationTestSuite(t *testing.T) {
|
|
suite.Run(t, new(IntegrationTestSuite))
|
|
}
|
|
*/
|
|
package network
|