Skip to content

Commit

Permalink
tests: add testing stubs with scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed Oct 22, 2024
1 parent bebe43f commit 3529bbf
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/interchain/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,57 @@ func (s *ProviderSuite) TestConsumerRemovalProposal() {
s.Require().NoError(err)
s.Require().Equal(providertypes.CONSUMER_PHASE_DELETED.String(), chainToRemove.Phase)
}

////////////////////////////////////////////////////////////
// Chain CRUD flow test //
////////////////////////////////////////////////////////////

// Each test can be divided into smaller tests if the developer wants to.

// Test Creating a chain (MsgCreateConsumer)
// Confirm that a chain can be create with the minimum params (metadata)
// Confirm that a chain can be created with all params
// Confirm that a chain can be created with a future and a past spawn time
// Confirm that a chain with TopN > 0 is rejected (this is done giva governance and should be tested in a different test)
// If there are no opted-in validators, the chain should not start.
func (s *ProviderSuite) TestProviderCreateConsumer() {
}

// Test Opting in validators to a chain (MsgOptIn)
// Confirm that a chain can be created and validators can be opted in
// Scenario 1: No validators opted in spawn time is in the past, the chain should not start.
// Scenario 2: Validators opted in, MsgUpdateConsumer called to set spawn time in the past -> chain should start.
// Scenario 3: Validators opted in, spawn time is in the future, the chain should not start before the spawn time.
func (s *ProviderSuite) TestProviderValidatorOptIn() {
}

// Test Updating a chain (MsgUpdateConsumer)
// Confirm that a chain can be created and updated with the minimum params (metadata), all params, a future and a past spawn time
// If there are no opted-in validators and the spawn time is in the past, the chain should not start.
// Confirm that a chain with TopN > 0 is rejected
func (s *ProviderSuite) TestProviderUpdateConsumer() {
}

// Test Opting in with key assignment validators to a chain (MsgOptIn with a KeyAssignment during OptIn)
// Events: MsgCreateConsumer (spawn time unset), MsgOptIn with KeyAssignment, MsgUpdateConsumer (set spawn time in the past)
// -> Check that consumer chain genesis is available and contains the correct validator key
// If possible, confirm that a validator can change their key assignment (from hub key to consumer chain key and/or vice versa)
func (s *ProviderSuite) TestProviderValidatorOptInWithKeyAssignment() {
}

// Create a chain, opt-in validators, and transform the opt-in to TopN via `tx gov submit-proposal` using MsgUpdateConsumer
// Confirm that the chain starts successfully
// Confirm that the chain can be updated to a lower TopN
// Confirm that the chain can be updated to a higher TopN
func (s *ProviderSuite) TestProviderTransformOptinToTopN() {
}

// Test removing a chain (MsgRemoveConsumer)
func (s *ProviderSuite) TestProviderUpgrade() {
}

// Confirm that only the owner can send MsgUpdateConsumer, MsgRemoveConsumer
// Confirm that ownership can be transferred to a different address -> results in the "old" owner losing ownership
// Confirm that submitting a gov proposal with MsgUpdateConsumer transfers ownership to the gov module account (chain must be topN)
func (s *ProviderSuite) TestProviderOwnerChecks() {
}

0 comments on commit 3529bbf

Please sign in to comment.