-
Notifications
You must be signed in to change notification settings - Fork 584
/
current.go
59 lines (50 loc) · 1.7 KB
/
current.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package configurer
import (
"os"
"testing"
"time"
"github.com/osmosis-labs/osmosis/v21/tests/e2e/configurer/chain"
"github.com/osmosis-labs/osmosis/v21/tests/e2e/containers"
"github.com/osmosis-labs/osmosis/v21/tests/e2e/initialization"
)
type CurrentBranchConfigurer struct {
baseConfigurer
}
var _ Configurer = (*CurrentBranchConfigurer)(nil)
func NewCurrentBranchConfigurer(t *testing.T, chainConfigs []*chain.Config, setupTests setupFn, containerManager *containers.Manager) Configurer {
t.Helper()
return &CurrentBranchConfigurer{
baseConfigurer: baseConfigurer{
chainConfigs: chainConfigs,
containerManager: containerManager,
setupTests: setupTests,
syncUntilHeight: defaultSyncUntilHeight,
t: t,
},
}
}
func (cb *CurrentBranchConfigurer) ConfigureChains() error {
for _, chainConfig := range cb.chainConfigs {
if err := cb.ConfigureChain(chainConfig); err != nil {
return err
}
}
return nil
}
func (cb *CurrentBranchConfigurer) ConfigureChain(chainConfig *chain.Config) error {
cb.t.Logf("starting e2e infrastructure from current branch for chain-id: %s", chainConfig.Id)
tmpDir, err := os.MkdirTemp("", "osmosis-e2e-testnet-")
if err != nil {
return err
}
cb.t.Logf("temp directory for chain-id %v: %v", chainConfig.Id, tmpDir)
initializedChain, err := initialization.InitChain(chainConfig.Id, tmpDir, chainConfig.ValidatorInitConfigs, time.Duration(chainConfig.VotingPeriod*1000000000), time.Duration(chainConfig.ExpeditedVotingPeriod*1000000000), 0)
if err != nil {
return err
}
cb.initializeChainConfigFromInitChain(initializedChain, chainConfig)
return nil
}
func (cb *CurrentBranchConfigurer) RunSetup() error {
return cb.setupTests(cb)
}