Skip to content

Commit

Permalink
pull chain temp folder creation our of chain to e2e package
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Apr 22, 2022
1 parent 97211cc commit c175289
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
10 changes: 2 additions & 8 deletions tests/e2e/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package chain

import (
"fmt"
"io/ioutil"
)

const (
Expand All @@ -16,15 +15,10 @@ type Chain struct {
Validators []*Validator
}

func new(id string) (*Chain, error) {
tmpDir, err := ioutil.TempDir("", "osmosis-e2e-testnet-")
if err != nil {
return nil, err
}

func new(id, dataDir string) (*Chain, error) {
return &Chain{
Id: id,
DataDir: tmpDir,
DataDir: dataDir,
}, nil
}

Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/chain/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package chain

func Init(id string) (*Chain, error) {
chain, err := new(id)
func Init(id, dataDir string) (*Chain, error) {

chain, err := new(id, dataDir)
if err != nil {
return nil, err
}
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ func (s *IntegrationTestSuite) runIBCRelayer() {

func (s *IntegrationTestSuite) configureChain(chainId string) {
s.T().Logf("starting e2e infrastructure for chain-id: %s", chainId)
newChain, err := chain.Init(chainId)
tmpDir, err := ioutil.TempDir("", "osmosis-e2e-testnet-")
s.Require().NoError(err)
newChain, err := chain.Init(chainId, tmpDir)
s.chains = append(s.chains, newChain)
s.Require().NoError(err)
}
Expand Down

0 comments on commit c175289

Please sign in to comment.