fixture

package
v2.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 26 Imported by: 4

Documentation

Overview

Package fixture defines fixture interfaces and implementations for testing server implementations with multiple backends.

Currently one backend - an in-memory store with no ABCI application is supported in configuration.Fixture.

A multi-node in-process ABCI-based backend for full integration tests is planned based on to the Cosmos SDK in-process integration test framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressHash

func AddressHash(prefix string, contents []byte) []byte

func TypeURL

func TypeURL(req proto.Message) string

Types

type CallInfo

type CallInfo struct {
	Method string
	Caller ModuleID
}

type Factory

type Factory interface {

	// Setup runs necessary fixture setup and returns a fresh Fixture environment.
	Setup() Fixture

	// BaseApp returns the baseApp used in the test fixture..
	BaseApp() *baseapp.BaseApp

	// Codec returns the codec.
	Codec() *codec.ProtoCodec

	// SetModules sets the modules to be used in the test fixture.
	SetModules(modules []sdkmodules.AppModule)
}

Factory defines an interface for creating server test fixtures

func NewFixtureFactory

func NewFixtureFactory(t gocuke.TestingT, numSigners int) Factory

type Fixture

type Fixture interface {

	// Context is the context.Context to be used with gRPC generated client code.
	Context() context.Context

	// TxConn is the grpc.ClientConnInterface to be used when constructing Msg service clients.
	TxConn() grpc.ClientConnInterface

	// QueryConn is the grpc.ClientConnInterface to be used when constructing Query service clients.
	QueryConn() grpc.ClientConnInterface

	// Signers are a list of addresses which can be used to sign transactions. They may either be
	// random or correspond to nodes in a test network which have keyrings.
	Signers() []sdk.AccAddress

	// InitGenesis initializes genesis for all modules with provided genesisData.
	InitGenesis(ctx sdk.Context, genesisData map[string]json.RawMessage) (abci.ResponseInitChain, error)

	// ExportGenesis returns raw encoded JSON genesis state for all modules.
	ExportGenesis(ctx sdk.Context) (map[string]json.RawMessage, error)

	// Codec is the app ProtoCodec.
	Codec() *codec.ProtoCodec

	// Teardown performs any teardown actions for the fixture.
	Teardown()
}

Fixture defines an interface for interacting with app services in tests independent of the backend.

type Invoker

type Invoker func(ctx context.Context, request, response interface{}, opts ...interface{}) error

type InvokerConn

type InvokerConn interface {
	grpc.ClientConnInterface
	Invoker(methodName string) (Invoker, error)
}

type InvokerFactory

type InvokerFactory func(callInfo CallInfo) (Invoker, error)

type MockModule

type MockModule struct{}

func (MockModule) ConsensusVersion

func (m MockModule) ConsensusVersion() uint64

func (MockModule) DefaultGenesis

func (m MockModule) DefaultGenesis(_ codec.JSONCodec) json.RawMessage

func (MockModule) ExportGenesis

func (m MockModule) ExportGenesis(_ sdk.Context, _ codec.JSONCodec) json.RawMessage

func (MockModule) GetQueryCmd

func (m MockModule) GetQueryCmd() *cobra.Command

func (MockModule) GetTxCmd

func (m MockModule) GetTxCmd() *cobra.Command

func (MockModule) InitGenesis

func (MockModule) LegacyQuerierHandler

func (m MockModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier

func (MockModule) Name

func (m MockModule) Name() string

func (MockModule) QuerierRoute

func (m MockModule) QuerierRoute() string

func (MockModule) RegisterGRPCGatewayRoutes

func (m MockModule) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux)

func (MockModule) RegisterInterfaces

func (m MockModule) RegisterInterfaces(_ types.InterfaceRegistry)

func (MockModule) RegisterInvariants

func (m MockModule) RegisterInvariants(_ sdk.InvariantRegistry)

func (MockModule) RegisterLegacyAminoCodec

func (m MockModule) RegisterLegacyAminoCodec(_ *codec.LegacyAmino)

func (MockModule) RegisterServices

func (m MockModule) RegisterServices(_ module.Configurator)

func (MockModule) Route

func (m MockModule) Route() sdk.Route

func (MockModule) ValidateGenesis

type ModuleID

type ModuleID struct {
	ModuleName string
	Path       []byte
}

func (ModuleID) Address

func (m ModuleID) Address() sdk.AccAddress

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL