integration

package
v0.52.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Overview

Integration contains the integration test setup used for SDK modules. To see how to use this, check the tests/integration/example_test.go file.

Index

Constants

This section is empty.

Variables

CreateMultiStore is a helper for setting up multiple stores for provided modules. Deprecated: use github.com/cosmos/cosmos-sdk/types/module/testutil.CreateMultiStore instead.

Functions

This section is empty.

Types

type App

type App struct {
	*baseapp.BaseApp
	// contains filtered or unexported fields
}

App is a test application that can be used to test the integration of modules.

func NewIntegrationApp

func NewIntegrationApp(
	logger log.Logger,
	keys map[string]*storetypes.KVStoreKey,
	appCodec codec.Codec,
	addressCodec address.Codec,
	validatorCodec address.Codec,
	modules map[string]appmodule.AppModule,
	msgRouter *baseapp.MsgServiceRouter,
	grpcRouter *baseapp.GRPCQueryRouter,
	baseAppOptions ...func(*baseapp.BaseApp),
) *App

NewIntegrationApp creates an application for testing purposes. This application is able to route messages to their respective handlers.

func (*App) Context

func (app *App) Context() context.Context

Context returns the application context. It can be unwrapped to a sdk.Context, with the sdk.UnwrapSDKContext function.

func (*App) NextBlock

func (app *App) NextBlock(txsblob ...[]byte) (int64, error)

NextBlock advances the chain height and returns the new height.

func (*App) QueryHelper

func (app *App) QueryHelper() *baseapp.QueryServiceTestHelper

QueryHelper returns the application query helper. It can be used when registering query services.

func (*App) RunMsg

func (app *App) RunMsg(msg sdk.Msg, option ...Option) (*codectypes.Any, error)

RunMsg provides the ability to run a message and return the response. In order to run a message, the application must have a handler for it. These handlers are registered on the application message service router. The result of the message execution is returned as an Any type. That any type can be unmarshaled to the expected response type. If the message execution fails, an error is returned.

type Config

type Config struct {
	AutomaticFinalizeBlock bool
	AutomaticCommit        bool
}

Config is the configuration for the integration app.

type Option

type Option func(*Config)

Option is a function that can be used to configure the integration app.

func WithAutomaticCommit

func WithAutomaticCommit() Option

WithAutomaticCommit enables automatic commit. This means that the integration app will automatically commit the state after each msgs.

func WithAutomaticFinalizeBlock

func WithAutomaticFinalizeBlock() Option

WithAutomaticFinalizeBlock calls ABCI finalize block.

Jump to

Keyboard shortcuts

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