Documentation ¶
Index ¶
- Constants
- func DefaultConfig() *testnode.Config
- func FillBlocks(ctx context.Context, cctx testnode.Context, accounts []string, ...) chan error
- type Option
- type Swamp
- func (s *Swamp) Connect(t *testing.T, peerA, peerB *nodebuilder.Node)
- func (s *Swamp) DefaultTestConfig(tp node.Type) *nodebuilder.Config
- func (s *Swamp) Disconnect(t *testing.T, peerA, peerB *nodebuilder.Node)
- func (s *Swamp) GetCoreBlockHashByHeight(ctx context.Context, height int64) libhead.Hash
- func (s *Swamp) NewBridgeNode(options ...fx.Option) *nodebuilder.Node
- func (s *Swamp) NewFullNode(options ...fx.Option) *nodebuilder.Node
- func (s *Swamp) NewLightNode(options ...fx.Option) *nodebuilder.Node
- func (s *Swamp) NewNodeWithConfig(nodeType node.Type, cfg *nodebuilder.Config, options ...fx.Option) *nodebuilder.Node
- func (s *Swamp) NewNodeWithStore(tp node.Type, store nodebuilder.Store, options ...fx.Option) *nodebuilder.Node
- func (s *Swamp) SetBootstrapper(t *testing.T, bootstrappers ...*nodebuilder.Node)
- func (s *Swamp) StopNode(ctx context.Context, nd *nodebuilder.Node)
- func (s *Swamp) Validators(t *testing.T) (*types.ValidatorSet, types.PrivValidator)
- func (s *Swamp) WaitTillHeight(ctx context.Context, height int64) libhead.Hash
Constants ¶
const DefaultTestTimeout = time.Minute * 5
DefaultTestTimeout should be used as the default timout on all the Swamp tests. It's generously set to 5 minutes to give enough time for CI.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfig ¶ added in v0.7.0
DefaultConfig creates a celestia-app instance with a block time of around 100ms
Types ¶
type Option ¶
Option for modifying Swamp's Config.
func WithBlockTime ¶
WithBlockTime sets a custom interval for block creation.
type Swamp ¶
type Swamp struct { Network mocknet.Mocknet Bootstrappers []ma.Multiaddr ClientContext testnode.Context Accounts []string // contains filtered or unexported fields }
Swamp represents the main functionality that is needed for the test-case: - Network to link the nodes - CoreClient to share between Bridge nodes - Slices of created Bridge/Full/Light Nodes - trustedHash taken from the CoreClient and shared between nodes
func (*Swamp) Connect ¶
func (s *Swamp) Connect(t *testing.T, peerA, peerB *nodebuilder.Node)
Connect allows to connect peers after hard disconnection.
func (*Swamp) DefaultTestConfig ¶ added in v0.10.0
func (s *Swamp) DefaultTestConfig(tp node.Type) *nodebuilder.Config
DefaultTestConfig creates a test config with the access to the core node for the tp
func (*Swamp) Disconnect ¶
func (s *Swamp) Disconnect(t *testing.T, peerA, peerB *nodebuilder.Node)
Disconnect allows to break a connection between two peers without any possibility to re-establish it. Order is very important here. We have to unlink peers first, and only after that call disconnect. This is hard disconnect and peers will not be able to reconnect. In order to reconnect peers again, please use swamp.Connect
func (*Swamp) GetCoreBlockHashByHeight ¶
GetCoreBlockHashByHeight returns a tendermint block's hash by provided height
func (*Swamp) NewBridgeNode ¶
func (s *Swamp) NewBridgeNode(options ...fx.Option) *nodebuilder.Node
NewBridgeNode creates a new instance of a BridgeNode providing a default config and a mockstore to the NewNodeWithStore method
func (*Swamp) NewFullNode ¶
func (s *Swamp) NewFullNode(options ...fx.Option) *nodebuilder.Node
NewFullNode creates a new instance of a FullNode providing a default config and a mockstore to the NewNodeWithStore method
func (*Swamp) NewLightNode ¶
func (s *Swamp) NewLightNode(options ...fx.Option) *nodebuilder.Node
NewLightNode creates a new instance of a LightNode providing a default config and a mockstore to the NewNodeWithStore method
func (*Swamp) NewNodeWithConfig ¶
func (s *Swamp) NewNodeWithConfig(nodeType node.Type, cfg *nodebuilder.Config, options ...fx.Option) *nodebuilder.Node
func (*Swamp) NewNodeWithStore ¶
func (s *Swamp) NewNodeWithStore( tp node.Type, store nodebuilder.Store, options ...fx.Option, ) *nodebuilder.Node
NewNodeWithStore creates a new instance of Node with predefined Store.
func (*Swamp) SetBootstrapper ¶ added in v0.11.0
func (s *Swamp) SetBootstrapper(t *testing.T, bootstrappers ...*nodebuilder.Node)
SetBootstrapper sets the given bootstrappers as the "bootstrappers" for the Swamp test suite. Every new full or light node created on the suite afterwards will automatically add the suite's bootstrappers as trusted peers to their config. NOTE: Bridge nodes do not automaatically add the bootstrappers as trusted peers. NOTE: Use `NewNodeWithStore` to avoid this automatic configuration.
func (*Swamp) StopNode ¶ added in v0.11.0
func (s *Swamp) StopNode(ctx context.Context, nd *nodebuilder.Node)
StopNode stops the node and removes from Swamp. TODO(@Wondertan): For clean and symmetrical API, we may want to add StartNode.
func (*Swamp) Validators ¶ added in v0.11.0
func (s *Swamp) Validators(t *testing.T) (*types.ValidatorSet, types.PrivValidator)
Validators retrieves keys from the app node in order to build the validators.