Skip to content
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

add back ibc e2e tests #1625

Merged
merged 10 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ func (s *IntegrationTestSuite) SetupSuite() {
s.initValidatorConfigs(s.chainA)
s.runValidators(s.chainA, 0)

// s.T().Logf("starting e2e infrastructure for chain B; chain-id: %s; datadir: %s", s.chainB.id, s.chainB.dataDir)
// s.initNodes(s.chainB)
// s.initGenesis(s.chainB)
// s.initValidatorConfigs(s.chainB)
// s.runValidators(s.chainB, 10)
s.T().Logf("starting e2e infrastructure for chain B; chain-id: %s; datadir: %s", s.chainB.id, s.chainB.dataDir)
s.initNodes(s.chainB)
s.initGenesis(s.chainB)
s.initValidatorConfigs(s.chainB)
s.runValidators(s.chainB, 10)

// s.runIBCRelayer()
s.runIBCRelayer()
}

func (s *IntegrationTestSuite) TearDownSuite() {
Expand All @@ -140,7 +140,7 @@ func (s *IntegrationTestSuite) TearDownSuite() {

s.T().Log("tearing down e2e integration test suite...")

// s.Require().NoError(s.dkrPool.Purge(s.hermesResource))
s.Require().NoError(s.dkrPool.Purge(s.hermesResource))

for _, vr := range s.valResources {
for _, r := range vr {
Expand All @@ -151,7 +151,7 @@ func (s *IntegrationTestSuite) TearDownSuite() {
s.Require().NoError(s.dkrPool.RemoveNetwork(s.dkrNet))

os.RemoveAll(s.chainA.dataDir)
// os.RemoveAll(s.chainB.dataDir)
os.RemoveAll(s.chainB.dataDir)

for _, td := range s.tmpDirs {
os.RemoveAll(td)
Expand Down
21 changes: 7 additions & 14 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@ import (
"strings"
"time"

"github.com/ory/dockertest/v3/docker"

sdk "github.com/cosmos/cosmos-sdk/types"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

func (s *IntegrationTestSuite) TestIBCTokenTransfer() {
// TODO: Remove skip once IBC is reintegrated
s.T().Skip()
var ibcStakeDenom string

s.Run("send_photon_to_chainB", func() {
Expand Down Expand Up @@ -171,15 +167,7 @@ func (s *IntegrationTestSuite) TestGovSoftwareUpgrade() {
s.verifyChainHaltedAtUpgradeHeight(s.chainA, 0, proposalHeight)
s.T().Logf("Successfully halted chain at height %d", proposalHeight)

currentChain := s.chainA

for valIdx := range currentChain.validators {
var opts docker.RemoveContainerOptions
opts.ID = s.valResources[currentChain.id][valIdx].Container.ID
opts.Force = true
s.dkrPool.Client.RemoveContainer(opts)
s.T().Logf("Removed Container: %s", s.valResources[currentChain.id][valIdx].Container.Name[1:])
}
s.TearDownSuite()

s.T().Logf("Restarting containers")
s.SetupSuite()
Expand All @@ -199,6 +187,8 @@ func (s *IntegrationTestSuite) TestGovSoftwareUpgrade() {
}

func (s *IntegrationTestSuite) TestGovCancelSoftwareUpgrade() {
s.T().Skip()

chainAAPIEndpoint := fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
senderAddress, err := s.chainA.validators[0].keyInfo.GetAddress()
s.Require().NoError(err)
Expand Down Expand Up @@ -236,6 +226,9 @@ func (s *IntegrationTestSuite) fundCommunityPool(chainAAPIEndpoint string, sende

s.execDistributionFundCommunityPool(s.chainA, 0, chainAAPIEndpoint, sender, tokenAmount.String(), fees.String())

// there are still tokens being added to the community pool through block production rewards but they should be less than 500 tokens
marginOfErrorForBlockReward := sdk.NewInt64Coin("photon", 500)

s.Require().Eventually(
func() bool {
afterDistPhotonBalance, err := getSpecificBalance(chainAAPIEndpoint, distModuleAddress, tokenAmount.Denom)
Expand All @@ -244,7 +237,7 @@ func (s *IntegrationTestSuite) fundCommunityPool(chainAAPIEndpoint string, sende
}
s.Require().NoError(err)

return afterDistPhotonBalance.IsEqual(beforeDistPhotonBalance.Add(tokenAmount.Add(fees)))
return afterDistPhotonBalance.Sub(beforeDistPhotonBalance.Add(tokenAmount.Add(fees))).IsLT(marginOfErrorForBlockReward)
},
15*time.Second,
5*time.Second,
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/e2e_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ func (s *IntegrationTestSuite) executeGaiaTxCommand(ctx context.Context, c *chai

s.Require().Eventually(
func() bool {
time.Sleep(3 * time.Second)
exec, err := s.dkrPool.Client.CreateExec(docker.CreateExecOptions{
Context: ctx,
AttachStdout: true,
Expand All @@ -356,6 +357,7 @@ func (s *IntegrationTestSuite) executeGaiaTxCommand(ctx context.Context, c *chai
time.Second,
"tx returned a non-zero code; stdout: %s, stderr: %s", outBuf.String(), errBuf.String(),
)
endpoint = fmt.Sprintf("http://%s", s.valResources[s.chainA.id][0].GetHostPort("1317/tcp"))
s.Require().Eventually(
func() bool {
return queryGaiaTx(endpoint, txResp.TxHash) == nil
Expand Down