Skip to content

Commit

Permalink
e2e: refactor initialization with single node logic (#1963)
Browse files Browse the repository at this point in the history
* e2e: refactor initialization with single node logic

* lint and remove redundant getters from node

* restore accidental change

* rename init to InitChain

* persistentPeers typo

(cherry picked from commit 1da14b8)

# Conflicts:
#	tests/e2e/e2e_setup_test.go
#	tests/e2e/e2e_test.go
#	tests/e2e/e2e_util_test.go
#	tests/e2e/initialization/init.go
#	tests/e2e/initialization/init_test.go
#	tests/e2e/initialization/node/main.go
  • Loading branch information
p0mvn authored and mergify[bot] committed Jul 11, 2022
1 parent 394313f commit e2742dc
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,23 @@ func (s *IntegrationTestSuite) configureChain(chainId string, validatorConfigs [
numVal := float32(len(validatorConfigs))

newChainConfig := chainConfig{
<<<<<<< HEAD
votingPeriod: propDepositBlocks + numVal*propVoteBlocks + propBufferBlocks,
skipRunValidatorIndexes: skipValidatorIndexes,
=======
votingPeriod: propDepositBlocks + numVal*propVoteBlocks + propBufferBlocks,
}

// If upgrade is skipped, we can use the chain initialization logic from
// current branch directly. As a result, there is no need to run this
// via Docker.

if s.skipUpgrade {
initializedChain, err := initialization.InitChain(chainId, tmpDir, validatorConfigs, time.Duration(newChainConfig.votingPeriod), s.forkHeight)
s.Require().NoError(err)
s.initializeChainConfig(&newChainConfig, initializedChain)
return
>>>>>>> 1da14b8b (e2e: refactor initialization with single node logic (#1963))
}

votingPeriodDuration := time.Duration(int(newChainConfig.votingPeriod) * 1000000000)
Expand Down Expand Up @@ -488,8 +503,15 @@ func (s *IntegrationTestSuite) configureDockerResources(chainIDOne, chainIDTwo s
s.dkrPool, err = dockertest.NewPool("")
s.Require().NoError(err)

<<<<<<< HEAD
s.dkrNet, err = s.dkrPool.CreateNetwork(fmt.Sprintf("%s-%s-testnet", chainIDOne, chainIDTwo))
s.Require().NoError(err)
=======
chainConfig.validators = make([]*validatorConfig, 0, len(initializedChain.Nodes))
for _, val := range initializedChain.Nodes {
chainConfig.validators = append(chainConfig.validators, &validatorConfig{validator: *val})
}
>>>>>>> 1da14b8b (e2e: refactor initialization with single node logic (#1963))

s.valResources = make(map[string][]*dockertest.Resource)
}
Expand Down
9 changes: 9 additions & 0 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ func (s *IntegrationTestSuite) TestIBCTokenTransfer() {
}

func (s *IntegrationTestSuite) TestSuperfluidVoting() {
<<<<<<< HEAD
const walletName = "wallet"
=======
if s.skipUpgrade {
// TODO: https://github.com/osmosis-labs/osmosis/issues/1843
s.T().Skip("Superfluid tests are broken when upgrade is skipped. To be fixed in #1843")
}
const walletName = "superfluid-wallet"

>>>>>>> 1da14b8b (e2e: refactor initialization with single node logic (#1963))
chainA := s.chainConfigs[0]
s.submitSuperfluidProposal(chainA, "gamm/pool/1")
s.depositProposal(chainA)
Expand Down
9 changes: 9 additions & 0 deletions tests/e2e/e2e_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,18 @@ func (s *IntegrationTestSuite) queryPropTally(endpoint, addr string) (sdk.Int, s

func (s *IntegrationTestSuite) createPool(c *chainConfig, poolFile string, from string) {
s.T().Logf("creating pool for chain-id: %s", c.meta.Id)
<<<<<<< HEAD
cmd := []string{"osmosisd", "tx", "gamm", "create-pool", fmt.Sprintf("--pool-file=/osmosis/%s", poolFile), fmt.Sprintf("--chain-id=%s", c.meta.Id), "--from=val", "-b=block", "--yes", "--keyring-backend=test"}
s.ExecTx(c.meta.Id, 0, cmd, "code: 0")
s.T().Logf("successfully created pool from %s container: %s", s.valResources[c.meta.Id][0].Container.Name[1:], s.valResources[c.meta.Id][0].Container.ID)
=======
cmd := []string{"osmosisd", "tx", "gamm", "create-pool", fmt.Sprintf("--pool-file=/osmosis/%s", poolFile), fmt.Sprintf("--chain-id=%s", c.meta.Id), fmt.Sprintf("--from=%s", from), "-b=block", "--yes", "--keyring-backend=test"}
_, _, err := s.containerManager.ExecCmd(s.T(), c.meta.Id, 0, cmd, "code: 0")
s.Require().NoError(err)
validatorResource, exists := s.containerManager.GetValidatorResource(c.meta.Id, 0)
s.Require().True(exists)
s.T().Logf("successfully created pool from %s container: %s", validatorResource.Container.Name[1:], validatorResource.Container.ID)
>>>>>>> 1da14b8b (e2e: refactor initialization with single node logic (#1963))
}

func (s *IntegrationTestSuite) lockTokens(config *chainConfig, i int, tokens string, duration string, from string) {
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/initialization/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import (
"path/filepath"
"time"

<<<<<<< HEAD
"github.com/osmosis-labs/osmosis/v10/tests/e2e/util"
=======
"github.com/osmosis-labs/osmosis/v7/tests/e2e/util"
>>>>>>> 1da14b8b (e2e: refactor initialization with single node logic (#1963))
)

func InitChain(id, dataDir string, nodeConfigs []*NodeConfig, votingPeriod time.Duration, forkHeight int) (*Chain, error) {
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/initialization/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import (

"github.com/stretchr/testify/require"

<<<<<<< HEAD
"github.com/osmosis-labs/osmosis/v10/tests/e2e/initialization"
=======
"github.com/osmosis-labs/osmosis/v7/tests/e2e/initialization"
>>>>>>> 1da14b8b (e2e: refactor initialization with single node logic (#1963))
)

const forkHeight = 10
Expand Down
4 changes: 4 additions & 0 deletions tests/e2e/initialization/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import (
"strings"
"time"

<<<<<<< HEAD
"github.com/osmosis-labs/osmosis/v10/tests/e2e/initialization"
=======
"github.com/osmosis-labs/osmosis/v7/tests/e2e/initialization"
>>>>>>> 1da14b8b (e2e: refactor initialization with single node logic (#1963))
)

func main() {
Expand Down

0 comments on commit e2742dc

Please sign in to comment.