Skip to content

Commit

Permalink
chore: add identifier name to networks
Browse files Browse the repository at this point in the history
  • Loading branch information
RafilxTenfen committed Jul 30, 2024
1 parent 6785106 commit d1775a9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
18 changes: 12 additions & 6 deletions test/e2e/configurer/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ var (
// TODO currently only one configuration is available. Consider testing upgrades
// when necessary
func NewBTCTimestampingConfigurer(t *testing.T, isDebugLogEnabled bool) (Configurer, error) {
containerManager, err := containers.NewManager(isDebugLogEnabled, false, false)
identifier := t.Name()
containerManager, err := containers.NewManager(identifier, isDebugLogEnabled, false, false)
if err != nil {
return nil, err
}
Expand All @@ -130,7 +131,8 @@ func NewBTCTimestampingConfigurer(t *testing.T, isDebugLogEnabled bool) (Configu
}

func NewIBCTransferConfigurer(t *testing.T, isDebugLogEnabled bool) (Configurer, error) {
containerManager, err := containers.NewManager(isDebugLogEnabled, false, false)
identifier := t.Name()
containerManager, err := containers.NewManager(identifier, isDebugLogEnabled, false, false)
if err != nil {
return nil, err
}
Expand All @@ -147,7 +149,8 @@ func NewIBCTransferConfigurer(t *testing.T, isDebugLogEnabled bool) (Configurer,

// NewBTCTimestampingPhase2Configurer returns a new Configurer for BTC timestamping service (phase 2).
func NewBTCTimestampingPhase2Configurer(t *testing.T, isDebugLogEnabled bool) (Configurer, error) {
containerManager, err := containers.NewManager(isDebugLogEnabled, false, false)
identifier := t.Name()
containerManager, err := containers.NewManager(identifier, isDebugLogEnabled, false, false)
if err != nil {
return nil, err
}
Expand All @@ -164,7 +167,8 @@ func NewBTCTimestampingPhase2Configurer(t *testing.T, isDebugLogEnabled bool) (C

// NewBTCTimestampingPhase2RlyConfigurer returns a new Configurer for BTC timestamping service (phase 2), using the Go relayer (rly).
func NewBTCTimestampingPhase2RlyConfigurer(t *testing.T, isDebugLogEnabled bool) (Configurer, error) {
containerManager, err := containers.NewManager(isDebugLogEnabled, true, false)
identifier := t.Name()
containerManager, err := containers.NewManager(identifier, isDebugLogEnabled, true, false)
if err != nil {
return nil, err
}
Expand All @@ -181,7 +185,8 @@ func NewBTCTimestampingPhase2RlyConfigurer(t *testing.T, isDebugLogEnabled bool)

// NewBTCStakingConfigurer returns a new Configurer for BTC staking service
func NewBTCStakingConfigurer(t *testing.T, isDebugLogEnabled bool) (Configurer, error) {
containerManager, err := containers.NewManager(isDebugLogEnabled, false, false)
identifier := t.Name()
containerManager, err := containers.NewManager(identifier, isDebugLogEnabled, false, false)
if err != nil {
return nil, err
}
Expand All @@ -198,7 +203,8 @@ func NewBTCStakingConfigurer(t *testing.T, isDebugLogEnabled bool) (Configurer,

// NewSoftwareUpgradeConfigurer returns a new Configurer for Software Upgrade testing
func NewSoftwareUpgradeConfigurer(t *testing.T, isDebugLogEnabled bool, upgradePath string) (Configurer, error) {
containerManager, err := containers.NewManager(isDebugLogEnabled, false, true)
identifier := t.Name()
containerManager, err := containers.NewManager(identifier, isDebugLogEnabled, false, true)
if err != nil {
return nil, err
}
Expand Down
9 changes: 8 additions & 1 deletion test/e2e/containers/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ type Manager struct {
network *dockertest.Network
resources map[string]*dockertest.Resource
isDebugLogEnabled bool
identifier string
}

// NewManager creates a new Manager instance and initializes
// all Docker specific utilities. Returns an error if initialization fails.
func NewManager(isDebugLogEnabled bool, isCosmosRelayer, isUpgrade bool) (docker *Manager, err error) {
func NewManager(identifier string, isDebugLogEnabled bool, isCosmosRelayer, isUpgrade bool) (docker *Manager, err error) {
docker = &Manager{
ImageConfig: NewImageConfig(isCosmosRelayer, isUpgrade),
resources: make(map[string]*dockertest.Resource),
isDebugLogEnabled: isDebugLogEnabled,
identifier: identifier,
}
docker.pool, err = dockertest.NewPool("")
if err != nil {
Expand Down Expand Up @@ -380,3 +382,8 @@ func (m *Manager) RunChainInitResource(chainId string, chainVotingPeriod, chainE
}
return initResource, nil
}

// NetworkName returns the network name concatenated with the identifier name
func (m *Manager) NetworkName() string {
return fmt.Sprintf("bbn-testnet-%s", m.identifier)
}

0 comments on commit d1775a9

Please sign in to comment.