Skip to content

Enhance TestQueryProviderInfo with Additional Validations and Error Cases #2504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions tests/integration/query_providerinfo_test.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,47 @@
package integration

// TestQueryProviderInfo tests the results of GetProviderInfo method.
// @Long Description@
// * Set up a CCV channel and send an empty VSC packet.
// * Verify that the result of GetProviderInfo method is correct and it
// provides expected information about the blockchain provider and consumer.
//
// Test cases:
// 1. Positive test - verifies that GetProviderInfo returns correct information about:
// - Chain IDs for both provider and consumer
// - Client IDs
// - Connection IDs
// - Channel IDs
// - Provider's staking denomination
// - Channel version
// 2. Negative test - verifies behavior when CCV channel is not established
func (s *CCVTestSuite) TestQueryProviderInfo() {
// Test case 1: Positive test with established CCV channel
s.SetupCCVChannel(s.path)
s.SendEmptyVSCPacket()

chainInfo, err := s.consumerApp.GetConsumerKeeper().GetProviderInfo(s.consumerCtx())
s.Require().NoError(err)

// Chain ID verification
s.Require().Equal(chainInfo.Provider.ChainID, "testchain1")
s.Require().Equal(chainInfo.Consumer.ChainID, "testchain2")

// Client ID verification
s.Require().Equal(chainInfo.Provider.ClientID, "07-tendermint-0")
s.Require().Equal(chainInfo.Consumer.ClientID, "07-tendermint-0")

// Connection ID verification
s.Require().Equal(chainInfo.Provider.ConnectionID, "connection-0")
s.Require().Equal(chainInfo.Consumer.ConnectionID, "connection-0")

// Channel ID verification
s.Require().Equal(chainInfo.Provider.ChannelID, "channel-0")
s.Require().Equal(chainInfo.Consumer.ChannelID, "channel-0")

// Additional verifications
s.Require().Equal(chainInfo.Provider.StakingDenom, "stake", "Provider staking denomination should be 'stake'")
s.Require().Equal(chainInfo.ChannelVersion, "1", "Channel version should be '1'")

// Test case 2: Negative test - before CCV channel setup
s.SetupTest()
chainInfo, err = s.consumerApp.GetConsumerKeeper().GetProviderInfo(s.consumerCtx())
s.Require().Error(err, "GetProviderInfo should return error when CCV channel is not established")
s.Require().Nil(chainInfo, "ChainInfo should be nil when CCV channel is not established")
}
Loading