fix: fix the cli test cases for modules

This commit is contained in:
Sai Kumar 2022-04-29 09:50:27 +05:30
parent 752fb3944f
commit 760cddf698
7 changed files with 13 additions and 14 deletions

View File

@ -16,6 +16,8 @@ import (
"testing"
"time"
tmcfg "github.com/tendermint/tendermint/config"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/rs/zerolog"
@ -253,6 +255,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
ctx := server.NewDefaultContext()
tmCfg := ctx.Config
tmCfg.Consensus.TimeoutCommit = cfg.TimeoutCommit
tmCfg.Mode = tmcfg.ModeValidator
// Only allow the first validator to expose an RPC, API and gRPC
// server/client due to Tendermint in-process constraints.
@ -559,7 +562,7 @@ func (n *Network) LatestHeight() (int64, error) {
// committed after a given block. If that height is not reached within a timeout,
// an error is returned. Regardless, the latest height queried is returned.
func (n *Network) WaitForHeight(h int64) (int64, error) {
return n.WaitForHeightWithTimeout(h, 100*time.Second)
return n.WaitForHeightWithTimeout(h, time.Duration(10*time.Second))
}
// WaitForHeightWithTimeout is the same as WaitForHeight except the caller can

View File

@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/ethclient"
abciclient "github.com/tendermint/tendermint/abci/client"
tmos "github.com/tendermint/tendermint/libs/os"
tmtime "github.com/tendermint/tendermint/libs/time"
"github.com/tendermint/tendermint/node"
"github.com/tendermint/tendermint/rpc/client/local"
"github.com/tendermint/tendermint/types"
@ -144,8 +145,7 @@ func startInProcess(cfg Config, val *Validator) error {
}
func collectGenFiles(cfg Config, vals []*Validator, outputDir string) error {
// genTime := tmtime.Now()
genTime := time.Now()
genTime := tmtime.Now()
for i := 0; i < cfg.NumValidators; i++ {
tmCfg := vals[i].Ctx.Config

View File

@ -10,7 +10,7 @@ import (
func TestIntegrationTestSuite(t *testing.T) {
cfg := network.DefaultConfig()
cfg.NumValidators = 1
cfg.NumValidators = 2
suite.Run(t, NewIntegrationTestSuite(cfg))
}

View File

@ -62,11 +62,6 @@ func (s *IntegrationTestSuite) createAccountWithBalance(accountName string, acco
info, _, err := val.ClientCtx.Keyring.NewMnemonic(accountName, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.EthSecp256k1)
sr.NoError(err)
pubKey, err := info.GetPubKey()
sr.NoError(err)
val.ClientCtx.Keyring.SaveOfflineKey(accountName, pubKey)
newAddr, _ := info.GetAddress()
_, err = banktestutil.MsgSendExec(
val.ClientCtx,

View File

@ -9,6 +9,6 @@ import (
func TestIntegrationTestSuite(t *testing.T) {
cfg := network.DefaultConfig()
cfg.NumValidators = 1
cfg.NumValidators = 2
suite.Run(t, NewIntegrationTestSuite(cfg))
}

View File

@ -175,7 +175,7 @@ func (s *IntegrationTestSuite) TestGetQueryBondById() {
{
"invalid bond id",
[]string{
fmt.Sprint("not_found_bond_id"),
"not_found_bond_id",
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
true,
@ -246,7 +246,7 @@ func (s *IntegrationTestSuite) TestGetQueryBondListsByOwner() {
{
"invalid owner address",
[]string{
fmt.Sprint("not_found_bond_id"),
"not_found_bond_id",
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
true,

View File

@ -1,13 +1,14 @@
package testutil
import (
"testing"
"github.com/stretchr/testify/suite"
"github.com/tharsis/ethermint/testutil/network"
"testing"
)
func TestIntegrationTestSuite(t *testing.T) {
cfg := network.DefaultConfig()
cfg.NumValidators = 1
cfg.NumValidators = 2
suite.Run(t, NewIntegrationTestSuite(cfg))
}