Skip to content

Commit

Permalink
fix: node configs don't overwrite naming
Browse files Browse the repository at this point in the history
  • Loading branch information
RafilxTenfen committed Jul 26, 2024
1 parent 5696a72 commit 8ada4ee
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions test/e2e/configurer/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ func NewBTCTimestampingConfigurer(t *testing.T, isDebugLogEnabled bool) (Configu

return NewCurrentBranchConfigurer(t,
[]*chain.Config{
chain.New(t, containerManager, initialization.ChainAID, nodeConfigsWithIdentifier(identifier, validatorConfigsChainA), ibcConfigChainA),
chain.New(t, containerManager, initialization.ChainBID, nodeConfigsWithIdentifier(identifier, validatorConfigsChainB), ibcConfigChainB),
chain.New(t, containerManager, initialization.ChainAID, nodeCfgsWithIdentifier(identifier, validatorConfigsChainA), ibcConfigChainA),
chain.New(t, containerManager, initialization.ChainBID, nodeCfgsWithIdentifier(identifier, validatorConfigsChainB), ibcConfigChainB),
},
withIBC(baseSetup), // base set up with IBC
containerManager,
Expand All @@ -140,8 +140,8 @@ func NewIBCTransferConfigurer(t *testing.T, isDebugLogEnabled bool) (Configurer,

return NewCurrentBranchConfigurer(t,
[]*chain.Config{
chain.New(t, containerManager, initialization.ChainAID, nodeConfigsWithIdentifier(identifier, validatorConfigsChainA), ibcConfigChainA),
chain.New(t, containerManager, initialization.ChainBID, nodeConfigsWithIdentifier(identifier, validatorConfigsChainB), ibcConfigChainB),
chain.New(t, containerManager, initialization.ChainAID, nodeCfgsWithIdentifier(identifier, validatorConfigsChainA), ibcConfigChainA),
chain.New(t, containerManager, initialization.ChainBID, nodeCfgsWithIdentifier(identifier, validatorConfigsChainB), ibcConfigChainB),
},
withIBCTransferChannel(baseSetup), // base set up with IBC
containerManager,
Expand All @@ -158,8 +158,8 @@ func NewBTCTimestampingPhase2Configurer(t *testing.T, isDebugLogEnabled bool) (C

return NewCurrentBranchConfigurer(t,
[]*chain.Config{
chain.New(t, containerManager, initialization.ChainAID, nodeConfigsWithIdentifier(identifier, validatorConfigsChainA), ibcConfigChainA),
chain.New(t, containerManager, initialization.ChainBID, nodeConfigsWithIdentifier(identifier, validatorConfigsChainB), ibcConfigChainB),
chain.New(t, containerManager, initialization.ChainAID, nodeCfgsWithIdentifier(identifier, validatorConfigsChainA), ibcConfigChainA),
chain.New(t, containerManager, initialization.ChainBID, nodeCfgsWithIdentifier(identifier, validatorConfigsChainB), ibcConfigChainB),
},
withPhase2IBC(baseSetup), // IBC setup (requires contract address)
containerManager,
Expand All @@ -176,8 +176,8 @@ func NewBTCTimestampingPhase2RlyConfigurer(t *testing.T, isDebugLogEnabled bool)

return NewCurrentBranchConfigurer(t,
[]*chain.Config{
chain.New(t, containerManager, initialization.ChainAID, nodeConfigsWithIdentifier(identifier, validatorConfigsChainA), ibcConfigChainA),
chain.New(t, containerManager, initialization.ChainBID, nodeConfigsWithIdentifier(identifier, validatorConfigsChainB), ibcConfigChainB),
chain.New(t, containerManager, initialization.ChainAID, nodeCfgsWithIdentifier(identifier, validatorConfigsChainA), ibcConfigChainA),
chain.New(t, containerManager, initialization.ChainBID, nodeCfgsWithIdentifier(identifier, validatorConfigsChainB), ibcConfigChainB),
},
withPhase2RlyIBC(baseSetup), // IBC setup with wasmd and Go relayer
containerManager,
Expand All @@ -195,16 +195,25 @@ func NewBTCStakingConfigurer(t *testing.T, isDebugLogEnabled bool) (Configurer,
return NewCurrentBranchConfigurer(t,
[]*chain.Config{
// we only need 1 chain for testing BTC staking
chain.New(t, containerManager, initialization.ChainAID, nodeConfigsWithIdentifier(identifier, validatorConfigsChainA), nil),
chain.New(t, containerManager, initialization.ChainAID, nodeCfgsWithIdentifier(identifier, validatorConfigsChainA), nil),
},
baseSetup, // base set up
containerManager,
), nil
}

func nodeConfigsWithIdentifier(identifier string, cfgs []*initialization.NodeConfig) []*initialization.NodeConfig {
for _, cfg := range cfgs {
cfg.Name = fmt.Sprintf("%s-%s", cfg.Name, identifier)
func nodeCfgsWithIdentifier(identifier string, cfgs []*initialization.NodeConfig) []*initialization.NodeConfig {
newCfgs := make([]*initialization.NodeConfig, len(cfgs))
for i, cfg := range cfgs {
newCfgs[i] = &initialization.NodeConfig{
Name: fmt.Sprintf("%s-%s", cfg.Name, identifier),
Pruning: cfg.Pruning,
PruningKeepRecent: cfg.PruningKeepRecent,
PruningInterval: cfg.PruningInterval,
SnapshotInterval: cfg.SnapshotInterval,
SnapshotKeepRecent: cfg.SnapshotKeepRecent,
IsValidator: cfg.IsValidator,
}
}
return cfgs
return newCfgs
}

0 comments on commit 8ada4ee

Please sign in to comment.