Skip to content

Commit

Permalink
addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bermuell committed Oct 22, 2024
1 parent c59766e commit 701e6cb
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 11 deletions.
3 changes: 1 addition & 2 deletions tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2598,10 +2598,9 @@ func (tr Chain) AssignConsumerPubKey(action e2e.AssignConsumerPubKeyAction, verb
}

if !action.ExpectError {
// wait for inclusion in a block -> '--broadcast-mode block' is deprecated
tr.waitForTx(e2e.ChainID("provi"), bz, 30*time.Second)
}
// wait for inclusion in a block -> '--broadcast-mode block' is deprecated
//tr.waitBlocks(ChainID("provi"), 2, 30*time.Second)
}

// SlashMeterReplenishmentAction polls the slash meter on provider until value is achieved
Expand Down
10 changes: 6 additions & 4 deletions tests/e2e/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ type ValPubKey struct {
Value string `yaml:"value"`
}

func (tr Commands) UseCometMock() bool {
return tr.Target.UseCometMock()
}

func (tr Commands) ExecCommand(name string, arg ...string) *exec.Cmd {
return tr.Target.ExecCommand(name, arg...)
}
Expand Down Expand Up @@ -937,10 +941,8 @@ func (tr Commands) GetValidatorIP(chain ChainID, validator ValidatorID) string {

func (tr Commands) GetValidatorNode(chain ChainID, validator ValidatorID) string {
// for CometMock, validatorNodes are all the same address as the query node (which is CometMocks address)
// TODO: @bermuell Fix this !!!
/* if tr.useCometmock {
return tr.target.GetQueryNode(chain)
if tr.UseCometMock() {
return tr.GetQueryNode(chain)
}
*/
return "tcp://" + tr.GetValidatorIP(chain, validator) + ":26658"
}
2 changes: 1 addition & 1 deletion tests/e2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ func createTestConfigs(cfgType TestConfigType, providerVersions, consumerVersion
// createTestRunners creates test runners to run each test case on each target
func createTestRunners(testCases []testStepsWithConfig) []TestRunner {
runners := []TestRunner{}
targetCfg := TargetConfig{useGaia: *useGaia, localSdkPath: *localSdkPath, gaiaTag: *gaiaTag}
targetCfg := TargetConfig{useGaia: *useGaia, localSdkPath: *localSdkPath, gaiaTag: *gaiaTag, useCometMock: *useCometmock}

for _, tc := range testCases {
testConfigs := createTestConfigs(tc.config, providerVersions, consumerVersions)
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (tr Chain) waitForTx(chain ChainID, txResponse []byte, timeout time.Duratio
log.Printf("query transaction failed with err=%s, resp=%s", err.Error(), res)
panic(fmt.Sprintf("\n\nwaitForTx on chain '%s' has timed out after: %s\n\n", chain, timeout))
}
time.Sleep(1 * time.Second)
}
}

Expand Down
6 changes: 6 additions & 0 deletions tests/e2e/test_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type ExecutionTarget interface {
ExecCommand(name string, arg ...string) *exec.Cmd
// ExecDetachedCommand: when executed the command will be run in the background and call will return immediately
ExecDetachedCommand(name string, args ...string) *exec.Cmd
UseCometMock() bool
Start() error
Stop() error
Build() error
Expand All @@ -30,6 +31,7 @@ type TargetConfig struct {
useGaia bool
providerVersion string
consumerVersion string
useCometMock bool
}
type DockerContainer struct {
targetConfig TargetConfig
Expand Down Expand Up @@ -59,6 +61,10 @@ func createTarget(testCfg TestConfig, targetCfg TargetConfig, image string) (Doc
return target, nil
}

func (dc *DockerContainer) UseCometMock() bool {
return dc.targetConfig.useCometMock
}

func (dc *DockerContainer) GetTargetConfig() TargetConfig {
return dc.targetConfig
}
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/testlib/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ type PlatformDriver interface {
// ExecDetachedCommand: when executed the command will be run in the background and call will return immediately
ExecDetachedCommand(name string, args ...string) *exec.Cmd
GetTestScriptPath(isConsumer bool, script string) string
UseCometMock() bool
}
type TargetDriver interface {
// ChainCommands
Expand Down
10 changes: 6 additions & 4 deletions tests/e2e/v5/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ type Commands struct {
Target e2e.PlatformDriver
}

func (tr Commands) UseCometMock() bool {
return tr.Target.UseCometMock()
}

func (tr Commands) ExecCommand(name string, arg ...string) *exec.Cmd {
return tr.Target.ExecCommand(name, arg...)
}
Expand Down Expand Up @@ -801,10 +805,8 @@ func (tr Commands) GetQueryNodeRPCAddress(chain ChainID) string {

func (tr Commands) getValidatorNode(chain ChainID, validator ValidatorID) string {
// for CometMock, validatorNodes are all the same address as the query node (which is CometMocks address)
// TODO: @bermuell Fix this !!!
/* if tr.useCometmock {
return tr.target.GetQueryNode(chain)
if tr.UseCometMock() {
return tr.GetQueryNode(chain)
}
*/
return "tcp://" + tr.GetValidatorIP(chain, validator) + ":26658"
}

0 comments on commit 701e6cb

Please sign in to comment.