e2e

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

README

End To End Testing

E2e tests are categorized into files as follows:

  • setup.go - setup for the e2e tests
  • common.go - helper functions
  • channel_init.go - e2e tests for the Channel Initialization sub-protocol
  • valset_update.go - e2e tests for the Validator Set Update sub-protocol
  • unbonding.go - e2e tests for the Completion of Unbonding Operations
  • slashing.go - e2e tests for the Consumer Initiated Slashing sub-protocol
  • distribution.go - e2e tests for the Reward Distribution sub-protocol
  • stop_consumer.go - e2e tests for the Consumer Chain Removal sub-protocol
  • normal_operations.go - e2e tests for normal operations of ICS enabled chains
  • instance_test.go - ties the e2e test structure into golang's standard test mechanism, with appropriate definitions for concrete app types and setup callback

To run the e2e tests defined in this repo on any arbitrary consumer and provider implementation, copy the pattern exemplified in instance_test.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CCVTestSuite

type CCVTestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

CCVTestSuite is an in-mem test suite which implements the standard group of tests validating the e2e functionality of ccv enabled chains. Any method implemented for this struct will be ran when suite.Run() is called.

func NewCCVTestSuite

func NewCCVTestSuite(setupCallback SetupCallback) *CCVTestSuite

NewCCVTestSuite returns a new instance of CCVTestSuite, ready to be tested against using suite.Run().

func (*CCVTestSuite) CompleteSetupCCVChannel

func (suite *CCVTestSuite) CompleteSetupCCVChannel()

func (*CCVTestSuite) CreateCustomClient

func (suite *CCVTestSuite) CreateCustomClient(endpoint *ibctesting.Endpoint, unbondingPeriod time.Duration)

CreateCustomClient creates an IBC client on the endpoint using the given unbonding period. It will update the clientID for the endpoint if the message is successfully executed.

func (*CCVTestSuite) GetConsumerEndpointClientAndConsState added in v0.2.1

func (suite *CCVTestSuite) GetConsumerEndpointClientAndConsState() (exported.ClientState, exported.ConsensusState)

func (*CCVTestSuite) SendEmptyVSCPacket

func (suite *CCVTestSuite) SendEmptyVSCPacket()

SendEmptyVSCPacket sends a VSC packet without any changes to ensure that the channel gets established

func (*CCVTestSuite) SetupCCVChannel

func (suite *CCVTestSuite) SetupCCVChannel()

func (*CCVTestSuite) SetupTest

func (suite *CCVTestSuite) SetupTest()

SetupTest sets up in-mem state before every test

func (*CCVTestSuite) SetupTransferChannel

func (suite *CCVTestSuite) SetupTransferChannel()

func (*CCVTestSuite) StartSetupCCVChannel

func (suite *CCVTestSuite) StartSetupCCVChannel()

func (*CCVTestSuite) TestConsumerGenesis

func (suite *CCVTestSuite) TestConsumerGenesis()

func (*CCVTestSuite) TestHandleSlashPacketDistribution

func (suite *CCVTestSuite) TestHandleSlashPacketDistribution()

TestHandleSlashPacketDistribution tests the slashing of an undelegation balance by varying the slash packet VSC ID mapping to infraction heights lesser, equal or greater than the undelegation entry creation height

func (*CCVTestSuite) TestHandleSlashPacketDoubleSigning

func (suite *CCVTestSuite) TestHandleSlashPacketDoubleSigning()

TestHandleSlashPacketDoubleSigning tests the handling of a double-signing related slash packet, with e2e tests

func (*CCVTestSuite) TestHandleSlashPacketErrors

func (suite *CCVTestSuite) TestHandleSlashPacketErrors()

TestHandleSlashPacketErrors tests errors for the HandleSlashPacket method in an e2e testing setting

func (CCVTestSuite) TestHistoricalInfo

func (k CCVTestSuite) TestHistoricalInfo()

Tests the tracking of historical info in the context of new blocks being committed

func (*CCVTestSuite) TestInitTimeout

func (suite *CCVTestSuite) TestInitTimeout()

TestInitTimeout tests the init timeout

func (*CCVTestSuite) TestPacketRoundtrip

func (s *CCVTestSuite) TestPacketRoundtrip()

TestPacketRoundtrip tests a CCV packet roundtrip when tokens are bonded on provider

func (*CCVTestSuite) TestProviderChannelClosed

func (suite *CCVTestSuite) TestProviderChannelClosed()

TestProviderChannelClosed checks that a consumer chain panics when the provider channel was established and then closed

func (*CCVTestSuite) TestRedelegationNoConsumer

func (s *CCVTestSuite) TestRedelegationNoConsumer()

TestRedelegationNoConsumer tests a redelegate transaction submitted on a provider chain with no consumers

func (*CCVTestSuite) TestRedelegationProviderFirst

func (s *CCVTestSuite) TestRedelegationProviderFirst()

TestRedelegationWithConsumer tests a redelegate transaction submitted on a provider chain when the unbonding period elapses first on the provider chain

func (*CCVTestSuite) TestRewardsDistribution

func (s *CCVTestSuite) TestRewardsDistribution()

This test is valid for minimal viable consumer chain

func (*CCVTestSuite) TestSendSlashPacket

func (suite *CCVTestSuite) TestSendSlashPacket()

TestSendSlashPacket tests the functionality of SendSlashPacket and asserts state changes related to that method

func (*CCVTestSuite) TestSendSlashPacketDoubleSign

func (s *CCVTestSuite) TestSendSlashPacketDoubleSign()

func (*CCVTestSuite) TestSendSlashPacketDowntime

func (s *CCVTestSuite) TestSendSlashPacketDowntime()

TestSendDowntimePacket tests consumer initiated slashing

func (*CCVTestSuite) TestSendVSCMaturedPackets

func (suite *CCVTestSuite) TestSendVSCMaturedPackets()

TestSendVSCMaturedPackets tests the behavior of SendVSCMaturedPackets and related state checks

func (*CCVTestSuite) TestSlashPacketAcknowldgement

func (s *CCVTestSuite) TestSlashPacketAcknowldgement()

func (*CCVTestSuite) TestStopConsumerChain

func (s *CCVTestSuite) TestStopConsumerChain()

Tests the functionality of stopping a consumer chain at a higher level than unit tests

func (*CCVTestSuite) TestStopConsumerOnChannelClosed

func (s *CCVTestSuite) TestStopConsumerOnChannelClosed()

TODO Simon: implement OnChanCloseConfirm in IBC-GO testing to close the consumer chain's channel end

func (*CCVTestSuite) TestUnbondingNoConsumer

func (s *CCVTestSuite) TestUnbondingNoConsumer()

Bond some tokens on provider Unbond them to create unbonding op Check unbonding ops on both sides Advance time so that provider's unbonding op completes Check that unbonding has completed in provider staking

func (*CCVTestSuite) TestUndelegationDuringInit

func (s *CCVTestSuite) TestUndelegationDuringInit()

TestUndelegationDuringInit checks that before the CCV channel is established

  • no undelegations can complete, even if the provider unbonding period elapses
  • all the VSC packets are stored in state as pending
  • if the channel handshake times out, then the undelegation completes

func (*CCVTestSuite) TestUndelegationNormalOperation

func (s *CCVTestSuite) TestUndelegationNormalOperation()

TestUndelegationNormalOperation tests that undelegations complete after the unbonding period elapses on both the consumer and provider, without VSC packets timing out.

func (*CCVTestSuite) TestUndelegationVscTimeout

func (s *CCVTestSuite) TestUndelegationVscTimeout()

TestUndelegationVscTimeout tests that an undelegation completes after vscTimeoutPeriod even if it does not reach maturity on the consumer chain. In this case, the consumer chain is removed.

func (*CCVTestSuite) TestValidatorDoubleSigning

func (suite *CCVTestSuite) TestValidatorDoubleSigning()

TestValidatorDoubleSigning tests if a slash packet is sent when a double-signing evidence is handled by the evidence module

func (*CCVTestSuite) TestValidatorDowntime

func (suite *CCVTestSuite) TestValidatorDowntime()

TestValidatorDowntime tests if a slash packet is sent and if the outstanding slashing flag is switched when a validator has downtime on the slashing module

func (CCVTestSuite) ValidateEndpointsClientConfig added in v0.2.1

func (s CCVTestSuite) ValidateEndpointsClientConfig()

type ChainType

type ChainType int

ChainType defines the type of chain (either provider or consumer)

const (
	Provider ChainType = iota
	Consumer
)

type ConsumerDemocracyTestSuite

type ConsumerDemocracyTestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

func NewConsumerDemocracyTestSuite

func NewConsumerDemocracyTestSuite(setupCallback DemocSetupCallback) *ConsumerDemocracyTestSuite

NewCCVTestSuite returns a new instance of ConsumerDemocracyTestSuite, ready to be tested against using suite.Run().

func (*ConsumerDemocracyTestSuite) SetupTest

func (suite *ConsumerDemocracyTestSuite) SetupTest()

SetupTest sets up in-mem state before every test relevant to ccv with a democracy consumer

func (*ConsumerDemocracyTestSuite) TestDemocracyGovernanceWhitelisting

func (s *ConsumerDemocracyTestSuite) TestDemocracyGovernanceWhitelisting()

func (*ConsumerDemocracyTestSuite) TestDemocracyRewardsDistribution

func (s *ConsumerDemocracyTestSuite) TestDemocracyRewardsDistribution()

type DemocSetupCallback

type DemocSetupCallback func(t *testing.T) (
	coord *ibctesting.Coordinator,
	consumerChain *ibctesting.TestChain,
	consumerApp e2e.DemocConsumerApp,
)

Callback for instantiating a new coordinator, consumer test chain, and consumer app before every test defined on the suite.

type SetupCallback

type SetupCallback func(t *testing.T) (
	coord *ibctesting.Coordinator,
	providerChain *ibctesting.TestChain,
	consumerChain *ibctesting.TestChain,
	providerApp e2e.ProviderApp,
	consumerApp e2e.ConsumerApp,
)

Callback for instantiating a new coordinator, provider/consumer test chains, and provider/consumer app before every test defined on the suite.

Jump to

Keyboard shortcuts

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