From 31fe0cc171bb8105ace337d137cd9b34f0034fdd Mon Sep 17 00:00:00 2001 From: Sai Kumar Date: Fri, 23 Jun 2023 18:09:23 +0530 Subject: [PATCH] remove ths env variable check in e2e test suite setup --- sdkclient/tx/client.go | 4 ++-- tests/e2e/setup/chain.go | 6 +++--- tests/e2e/setup/setup.go | 20 +++++++++++++------- tests/qa/cw/cw_test.go | 6 +++--- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/sdkclient/tx/client.go b/sdkclient/tx/client.go index 97f3858e97..c074c4bde3 100644 --- a/sdkclient/tx/client.go +++ b/sdkclient/tx/client.go @@ -29,11 +29,11 @@ type Client struct { } // Initializes a cosmos sdk client context and transaction factory for -// signing and broadcasting transactions +// signing and broadcasting transactions by passing chainDataDir and remaining func arguments // Note: For signing the transactions accounts are created by names like this val0, val1.... func NewClient( chainDataDir, - chainID string, + chainID, tmrpcEndpoint string, mnemonics map[string]string, gasAdjustment float64, diff --git a/tests/e2e/setup/chain.go b/tests/e2e/setup/chain.go index 1d46b11d8e..717a2a0b1d 100644 --- a/tests/e2e/setup/chain.go +++ b/tests/e2e/setup/chain.go @@ -40,7 +40,7 @@ func init() { } type chain struct { - DataDir string + dataDir string ID string Validators []*validator Orchestrators []*orchestrator @@ -55,12 +55,12 @@ func newChain() (*chain, error) { return &chain{ ID: "chain-" + tmrand.NewRand().Str(6), - DataDir: tmpDir, + dataDir: tmpDir, }, nil } func (c *chain) configDir() string { - return fmt.Sprintf("%s/%s", c.DataDir, c.ID) + return fmt.Sprintf("%s/%s", c.dataDir, c.ID) } func (c *chain) createAndInitValidators(cdc codec.Codec, count int) error { diff --git a/tests/e2e/setup/setup.go b/tests/e2e/setup/setup.go index 39ad6bf879..6e89b63251 100644 --- a/tests/e2e/setup/setup.go +++ b/tests/e2e/setup/setup.go @@ -62,6 +62,8 @@ type E2ETestSuite struct { GravityContractAddr string Umee client.Client cdc codec.Codec + MinNetwork bool // MinNetwork defines which runs only validator wihtout price-feeder, gaia and ibc-relayer + } func (s *E2ETestSuite) SetupSuite() { @@ -74,7 +76,7 @@ func (s *E2ETestSuite) SetupSuite() { s.Chain, err = newChain() s.Require().NoError(err) - s.T().Logf("starting e2e infrastructure; chain-id: %s; datadir: %s", s.Chain.ID, s.Chain.DataDir) + s.T().Logf("starting e2e infrastructure; chain-id: %s; datadir: %s", s.Chain.ID, s.Chain.dataDir) s.DkrPool, err = dockertest.NewPool("") s.Require().NoError(err) @@ -110,10 +112,12 @@ func (s *E2ETestSuite) SetupSuite() { s.initGenesis() s.initValidatorConfigs() s.runValidators() - if str := os.Getenv("TEST_QA"); len(str) == 0 { + if !s.MinNetwork { s.runPriceFeeder() s.runGaiaNetwork() s.runIBCRelayer() + } else { + s.T().Log("running minimum network withut gaia,price-feeder and ibc-relayer") } // s.runContractDeployment() // s.runOrchestrators() @@ -133,9 +137,11 @@ func (s *E2ETestSuite) TearDownSuite() { s.T().Log("tearing down e2e integration test suite...") // s.Require().NoError(s.DkrPool.Purge(s.ethResource)) - s.Require().NoError(s.DkrPool.Purge(s.GaiaResource)) - s.Require().NoError(s.DkrPool.Purge(s.HermesResource)) - s.Require().NoError(s.DkrPool.Purge(s.priceFeederResource)) + if !s.MinNetwork { + s.Require().NoError(s.DkrPool.Purge(s.GaiaResource)) + s.Require().NoError(s.DkrPool.Purge(s.HermesResource)) + s.Require().NoError(s.DkrPool.Purge(s.priceFeederResource)) + } for _, vc := range s.ValResources { s.Require().NoError(s.DkrPool.Purge(vc)) @@ -147,7 +153,7 @@ func (s *E2ETestSuite) TearDownSuite() { s.Require().NoError(s.DkrPool.RemoveNetwork(s.DkrNet)) - os.RemoveAll(s.Chain.DataDir) + os.RemoveAll(s.Chain.dataDir) for _, td := range s.tmpDirs { os.RemoveAll(td) } @@ -1065,7 +1071,7 @@ func (s *E2ETestSuite) initUmeeClient() { } ecfg := app.MakeEncodingConfig() s.Umee, err = client.NewClient( - s.Chain.DataDir, + s.Chain.dataDir, s.Chain.ID, "tcp://localhost:26657", "tcp://localhost:9090", diff --git a/tests/qa/cw/cw_test.go b/tests/qa/cw/cw_test.go index 94727a1aa2..4f0217e54e 100644 --- a/tests/qa/cw/cw_test.go +++ b/tests/qa/cw/cw_test.go @@ -6,7 +6,6 @@ package cw import ( "encoding/json" "math/rand" - "os" "strings" "sync" "testing" @@ -32,9 +31,10 @@ var ( ) func TestQA(t *testing.T) { - os.Setenv("TEST_QA", "true") t.Log("Running qa test...") - suite.Run(t, new(QATest)) + qaTest := new(QATest) + qaTest.MinNetwork = true + suite.Run(t, qaTest) } func (qaTest *QATest) TestCWPlusGroup() {