Skip to content

Commit

Permalink
fix: e2e settings overrided (#7784)
Browse files Browse the repository at this point in the history
* fix e2e

* reject defaults

* add clarifying comment
  • Loading branch information
czarcas7ic authored Mar 20, 2024
1 parent bf01cf0 commit 452f273
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
6 changes: 4 additions & 2 deletions tests/e2e/configurer/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ func (bc *baseConfigurer) runValidators(chainConfig *chain.Config) error {
// Iterate over each node
for _, node := range chainConfig.NodeConfigs {
go func(n *chain.NodeConfig) {
defer wg.Done() // Decrement the WaitGroup counter when the goroutine is done
errCh <- n.Run() // Run the node and send any error to the channel
defer wg.Done() // Decrement the WaitGroup counter when the goroutine is done
// TODO: After v24, either set this to true or remove the entire logic added in https://github.com/osmosis-labs/osmosis/pull/7784
// and just set --reject-config-defaults=true directly here https://github.com/osmosis-labs/osmosis/blob/b106139bcfe5605fb2fedd6237d9467497cf3ded/tests/e2e/containers/containers.go#L492-L493
errCh <- n.Run(false) // Run the node and send any error to the channel
}(node)
}

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/configurer/chain/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func NewNodeConfig(t *testing.T, initNode *initialization.Node, initConfig *init
// Run runs a node container for the given nodeIndex.
// The node configuration must be already added to the chain config prior to calling this
// method.
func (n *NodeConfig) Run() error {
func (n *NodeConfig) Run(rejectConfigDefaults bool) error {
maxRetries := 3
currentRetry := 0

for currentRetry < maxRetries {
n.t.Logf("starting node container: %s", n.Name)
resource, err := n.containerManager.RunNodeResource(n.chainId, n.Name, n.ConfigDir)
resource, err := n.containerManager.RunNodeResource(n.chainId, n.Name, n.ConfigDir, rejectConfigDefaults)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/configurer/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func (uc *UpgradeConfigurer) upgradeContainers(chainConfig *chain.Config, propHe
uc.containerManager.OsmosisTag = containers.CurrentBranchOsmoTag

for _, node := range chainConfig.NodeConfigs {
if err := node.Run(); err != nil {
if err := node.Run(true); err != nil {
return err
}
}
Expand Down
9 changes: 7 additions & 2 deletions tests/e2e/containers/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,19 +472,24 @@ func (m *Manager) RunHermesResource(chainAID, osmoARelayerNodeName, osmoAValMnem

// RunNodeResource runs a node container. Assigns containerName to the container.
// Mounts the container on valConfigDir volume on the running host. Returns the container resource and error if any.
func (m *Manager) RunNodeResource(chainId string, containerName, valCondifDir string) (*dockertest.Resource, error) {
func (m *Manager) RunNodeResource(chainId string, containerName, valCondifDir string, rejectConfigDefaults bool) (*dockertest.Resource, error) {
pwd, err := os.Getwd()
if err != nil {
return nil, err
}

cmd := []string{"start"}
if rejectConfigDefaults {
cmd = append(cmd, "--reject-config-defaults=true")
}

runOpts := &dockertest.RunOptions{
Name: containerName,
Repository: m.OsmosisRepository,
Tag: m.OsmosisTag,
NetworkID: m.network.Network.ID,
User: "root:root",
Cmd: []string{"start"},
Cmd: cmd,
Mounts: []string{
fmt.Sprintf("%s/:/osmosis/.osmosisd", valCondifDir),
fmt.Sprintf("%s/scripts:/osmosis", pwd),
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (s *IntegrationTestSuite) StateSync() {
chainANode.WaitUntil(hasSnapshotsAvailable)

// start the state synchin node.
err = stateSynchingNode.Run()
err = stateSynchingNode.Run(true)
s.Require().NoError(err)

// ensure that the state syncing node cathes up to the running node.
Expand Down

0 comments on commit 452f273

Please sign in to comment.