Skip to content
Closed
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
3 changes: 2 additions & 1 deletion tests/e2e/e2e_erc20_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ func (s *IntegrationTestSuite) testERC20(jsonRPC string) {
sender := senderAddress.String()

s.Run("Register ERC20 proposal", func() {
proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter
s.writeERC20RegisterProposal(c, contractAddress)
submitGovFlags := []string{configFile(proposalRegisterERC20)}

Expand Down
12 changes: 8 additions & 4 deletions tests/e2e/e2e_gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
height := s.getLatestBlockHeight(s.chainA, 0)
proposalHeight := height + govProposalBlockBuffer
// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter

s.writeSoftwareUpgradeProposal(s.chainA, int64(proposalHeight), "upgrade-v0")

Expand All @@ -55,7 +56,7 @@
5*time.Second,
)

proposalCounter = 0

Check failure on line 59 in tests/e2e/e2e_gov_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

ineffectual assignment to proposalCounter (ineffassign)

Check failure on line 59 in tests/e2e/e2e_gov_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

ineffectual assignment to proposalCounter (ineffassign)
}

/*
Expand All @@ -75,7 +76,8 @@
s.writeSoftwareUpgradeProposal(s.chainA, int64(proposalHeight), "upgrade-v1")

// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter
submitGovFlags := []string{configFile(proposalSoftwareUpgrade)}

depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
Expand Down Expand Up @@ -114,7 +116,8 @@
s.Require().NoError(err)

// Gov tests may be run in arbitrary order, each test must increment proposalCounter to have the correct proposal id to submit and query
proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter
submitGovFlags := []string{configFile(proposalCommunitySpendFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
Expand Down Expand Up @@ -216,7 +219,8 @@
senderAddress, _ := s.chainA.validators[0].keyInfo.GetAddress()
sender := senderAddress.String()

proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter
s.writeExpeditedSoftwareUpgradeProp(s.chainA)
submitGovFlags := []string{configFile(proposalExpeditedSoftwareUpgrade)}

Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/e2e_oracle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ func (s *IntegrationTestSuite) checkAndUpdateOracleParams() {
// Get the chain and update its information
c := s.chainA
s.writeOracleParamChangeProposal(c)
proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter
submitGovFlags := []string{configFile(proposalUpdateRateLimitAtomFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
Expand Down
12 changes: 8 additions & 4 deletions tests/e2e/e2e_rate_limit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ func (s *IntegrationTestSuite) testAddRateLimits() {
validatorAAddr, _ := validatorA.keyInfo.GetAddress()

s.writeAddRateLimitAtomProposal(s.chainA)
proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter
submitGovFlags := []string{configFile(proposalAddRateLimitAtomFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
Expand Down Expand Up @@ -256,7 +257,8 @@ func (s *IntegrationTestSuite) testUpdateRateLimit() {
validatorAAddr, _ := validatorA.keyInfo.GetAddress()

s.writeUpdateRateLimitAtomProposal(s.chainA)
proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter
submitGovFlags := []string{configFile(proposalUpdateRateLimitAtomFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
Expand Down Expand Up @@ -289,7 +291,8 @@ func (s *IntegrationTestSuite) testResetRateLimit() {
validatorAAddr, _ := validatorA.keyInfo.GetAddress()

s.writeResetRateLimitAtomProposal(s.chainA)
proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter
submitGovFlags := []string{configFile(proposalResetRateLimitAtomFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
Expand Down Expand Up @@ -322,7 +325,8 @@ func (s *IntegrationTestSuite) testRemoveRateLimit() {
validatorAAddr, _ := validatorA.keyInfo.GetAddress()

s.writeRemoveRateLimitAtomProposal(s.chainA)
proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter
submitGovFlags := []string{configFile(proposalRemoveRateLimitAtomFilename)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/e2e_rewards_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ func (s *IntegrationTestSuite) passScheduleProposal(chainEndpoint string, amount
s.writeScheduleProposal(s.chainA, amount, endTime)

// Create command
proposalCounter++
s.proposalCounter++
proposalCounter := s.proposalCounter
submitGovFlags := []string{configFile(proposalAddSchedule)}
depositGovFlags := []string{strconv.Itoa(proposalCounter), depositAmount.String()}
voteGovFlags := []string{strconv.Itoa(proposalCounter), "yes"}
Expand Down
36 changes: 24 additions & 12 deletions tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"path/filepath"
"strconv"
"strings"
"sync/atomic"
"testing"
"time"

Expand Down Expand Up @@ -91,15 +92,15 @@
)

var (
kiichainConfigPath = filepath.Join(kiichainHomePath, "config")
stakingAmount = mustNewIntFromString("100000000000000000000000") // 100,000 Kii
stakingAmountCoin = sdk.NewCoin(akiiDenom, stakingAmount)
tokenAmount = sdk.NewCoin(akiiDenom, mustNewIntFromString("3300000000000000000000")) // 3,300 Kii
standardFees = sdk.NewCoin(akiiDenom, mustNewIntFromString("330000000000000000")) // 0.33 Kii
depositAmount = sdk.NewCoin(akiiDenom, mustNewIntFromString("330000000000000000000")) // 3,300 Kii
distModuleAddress = authtypes.NewModuleAddress(distrtypes.ModuleName).String()
govModuleAddress = authtypes.NewModuleAddress(govtypes.ModuleName).String()
proposalCounter = 0
kiichainConfigPath = filepath.Join(kiichainHomePath, "config")
stakingAmount = mustNewIntFromString("100000000000000000000000") // 100,000 Kii
stakingAmountCoin = sdk.NewCoin(akiiDenom, stakingAmount)
tokenAmount = sdk.NewCoin(akiiDenom, mustNewIntFromString("3300000000000000000000")) // 3,300 Kii
standardFees = sdk.NewCoin(akiiDenom, mustNewIntFromString("330000000000000000")) // 0.33 Kii
depositAmount = sdk.NewCoin(akiiDenom, mustNewIntFromString("330000000000000000000")) // 3,300 Kii
distModuleAddress = authtypes.NewModuleAddress(distrtypes.ModuleName).String()
govModuleAddress = authtypes.NewModuleAddress(govtypes.ModuleName).String()
testCounter uint64 = 0

Check failure on line 103 in tests/e2e/e2e_setup_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

var-declaration: should drop = 0 from declaration of var testCounter; it is the zero value (revive)

Check failure on line 103 in tests/e2e/e2e_setup_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

var-declaration: should drop = 0 from declaration of var testCounter; it is the zero value (revive)
)

type IntegrationTestSuite struct {
Expand All @@ -112,7 +113,9 @@
dkrNet *dockertest.Network
hermesResource *dockertest.Resource

valResources map[string][]*dockertest.Resource
valResources map[string][]*dockertest.Resource
proposalCounter int
testID uint64
}

type AddressResponse struct {
Expand All @@ -126,6 +129,15 @@
suite.Run(t, new(IntegrationTestSuite))
}

// Helper to create new test suite instance
func NewIntegrationTestSuite(t *testing.T) *IntegrationTestSuite {

Check failure on line 133 in tests/e2e/e2e_setup_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

test helper function should start from t.Helper() (thelper)

Check failure on line 133 in tests/e2e/e2e_setup_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

test helper function should start from t.Helper() (thelper)
s := &IntegrationTestSuite{}
s.SetT(t)
s.proposalCounter = 0
s.testID = atomic.AddUint64(&testCounter, 2)
return s
}

func (s *IntegrationTestSuite) SetupSuite() {
s.T().Log("setting up e2e integration test suite...")

Expand Down Expand Up @@ -161,13 +173,13 @@
s.initNodes(s.chainA)
s.initGenesis(s.chainA, vestingMnemonic, jailedValMnemonic)
s.initValidatorConfigs(s.chainA)
s.runValidators(s.chainA, 0)
s.runValidators(s.chainA, int(s.testID))

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, vestingMnemonic, jailedValMnemonic)
s.initValidatorConfigs(s.chainB)
s.runValidators(s.chainB, 10)
s.runValidators(s.chainB, int(s.testID-1))

time.Sleep(10 * time.Second)

Expand Down
Loading
Loading