integration

package
v0.52.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 23 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

This section is empty.

Functions

func CreateMultiStore

func CreateMultiStore(keys map[string]*storetypes.KVStoreKey, logger log.Logger) storetypes.CommitMultiStore

CreateMultiStore is a helper for setting up multiple stores for provided modules.

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(
	sdkCtx sdk.Context,
	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,
) *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) 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