Skip to content

Commit

Permalink
move ICTEST_RELAYER_LOOP_DURATION into cfg.Env
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Oct 3, 2024
1 parent 188f6c9 commit 1b91063
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 0 additions & 2 deletions docs/envOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

- `ICTEST_HOME`: The folder to use as the home / working directory.

- `ICTEST_RELAYER_LOOP_DURATION`: Override the default 50ms relayer loop check duration. Input is in time format (20ms, 1s, etc.). Extremely fast chains may require as low as 5-10ms.

- `ICTEST_SKIP_FAILURE_CLEANUP`: skip cleanup of the temporary directory on a test failure.

- `KEEP_CONTAINERS`: Prevents testnet cleanup after completion.
Expand Down
20 changes: 18 additions & 2 deletions relayer/rly/cosmos_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/docker/docker/client"
"github.com/strangelove-ventures/interchaintest/v8/dockerutil"
"github.com/strangelove-ventures/interchaintest/v8/ibc"
"github.com/strangelove-ventures/interchaintest/v8/relayer"
"go.uber.org/zap"
Expand Down Expand Up @@ -83,6 +82,23 @@ func ChainConfigToCosmosRelayerChainConfig(chainConfig ibc.ChainConfig, keyName,
if chainType == "polkadot" || chainType == "parachain" || chainType == "relaychain" {
chainType = "substrate"
}

var err error
var loopDuration = time.Millisecond * 50
for _, env := range chainConfig.Env {
if strings.Contains(env, "ICTEST_RELAYER_LOOP_DURATION") {
e := strings.Split(env, "=")
if len(e) != 2 {
panic(fmt.Sprintf("BUG: failed to parse %s", env))
}

loopDuration, err = time.ParseDuration(e[1])
if err != nil {
panic(fmt.Sprintf("BUG: failed to parse %s: %s", e[1], err))
}
}
}

return CosmosRelayerChainConfig{
Type: chainType,
Value: CosmosRelayerChainConfigValue{
Expand All @@ -98,7 +114,7 @@ func ChainConfigToCosmosRelayerChainConfig(chainConfig ibc.ChainConfig, keyName,
Timeout: "10s",
OutputFormat: "json",
SignMode: "direct",
MinLoopDuration: dockerutil.GetTimeFromEnv("ICTEST_RELAYER_LOOP_DURATION", time.Millisecond*50),
MinLoopDuration: loopDuration,
},
}
}
Expand Down

0 comments on commit 1b91063

Please sign in to comment.