fix: fix the cli test cases for modules
This commit is contained in:
parent
752fb3944f
commit
760cddf698
@ -16,6 +16,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
tmcfg "github.com/tendermint/tendermint/config"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/ethclient"
|
"github.com/ethereum/go-ethereum/ethclient"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
@ -253,6 +255,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
|
|||||||
ctx := server.NewDefaultContext()
|
ctx := server.NewDefaultContext()
|
||||||
tmCfg := ctx.Config
|
tmCfg := ctx.Config
|
||||||
tmCfg.Consensus.TimeoutCommit = cfg.TimeoutCommit
|
tmCfg.Consensus.TimeoutCommit = cfg.TimeoutCommit
|
||||||
|
tmCfg.Mode = tmcfg.ModeValidator
|
||||||
|
|
||||||
// Only allow the first validator to expose an RPC, API and gRPC
|
// Only allow the first validator to expose an RPC, API and gRPC
|
||||||
// server/client due to Tendermint in-process constraints.
|
// 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,
|
// 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.
|
// an error is returned. Regardless, the latest height queried is returned.
|
||||||
func (n *Network) WaitForHeight(h int64) (int64, error) {
|
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
|
// WaitForHeightWithTimeout is the same as WaitForHeight except the caller can
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/ethclient"
|
"github.com/ethereum/go-ethereum/ethclient"
|
||||||
abciclient "github.com/tendermint/tendermint/abci/client"
|
abciclient "github.com/tendermint/tendermint/abci/client"
|
||||||
tmos "github.com/tendermint/tendermint/libs/os"
|
tmos "github.com/tendermint/tendermint/libs/os"
|
||||||
|
tmtime "github.com/tendermint/tendermint/libs/time"
|
||||||
"github.com/tendermint/tendermint/node"
|
"github.com/tendermint/tendermint/node"
|
||||||
"github.com/tendermint/tendermint/rpc/client/local"
|
"github.com/tendermint/tendermint/rpc/client/local"
|
||||||
"github.com/tendermint/tendermint/types"
|
"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 {
|
func collectGenFiles(cfg Config, vals []*Validator, outputDir string) error {
|
||||||
// genTime := tmtime.Now()
|
genTime := tmtime.Now()
|
||||||
genTime := time.Now()
|
|
||||||
|
|
||||||
for i := 0; i < cfg.NumValidators; i++ {
|
for i := 0; i < cfg.NumValidators; i++ {
|
||||||
tmCfg := vals[i].Ctx.Config
|
tmCfg := vals[i].Ctx.Config
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
|
|
||||||
func TestIntegrationTestSuite(t *testing.T) {
|
func TestIntegrationTestSuite(t *testing.T) {
|
||||||
cfg := network.DefaultConfig()
|
cfg := network.DefaultConfig()
|
||||||
cfg.NumValidators = 1
|
cfg.NumValidators = 2
|
||||||
|
|
||||||
suite.Run(t, NewIntegrationTestSuite(cfg))
|
suite.Run(t, NewIntegrationTestSuite(cfg))
|
||||||
}
|
}
|
||||||
|
@ -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)
|
info, _, err := val.ClientCtx.Keyring.NewMnemonic(accountName, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.EthSecp256k1)
|
||||||
sr.NoError(err)
|
sr.NoError(err)
|
||||||
|
|
||||||
pubKey, err := info.GetPubKey()
|
|
||||||
sr.NoError(err)
|
|
||||||
|
|
||||||
val.ClientCtx.Keyring.SaveOfflineKey(accountName, pubKey)
|
|
||||||
|
|
||||||
newAddr, _ := info.GetAddress()
|
newAddr, _ := info.GetAddress()
|
||||||
_, err = banktestutil.MsgSendExec(
|
_, err = banktestutil.MsgSendExec(
|
||||||
val.ClientCtx,
|
val.ClientCtx,
|
||||||
|
@ -9,6 +9,6 @@ import (
|
|||||||
|
|
||||||
func TestIntegrationTestSuite(t *testing.T) {
|
func TestIntegrationTestSuite(t *testing.T) {
|
||||||
cfg := network.DefaultConfig()
|
cfg := network.DefaultConfig()
|
||||||
cfg.NumValidators = 1
|
cfg.NumValidators = 2
|
||||||
suite.Run(t, NewIntegrationTestSuite(cfg))
|
suite.Run(t, NewIntegrationTestSuite(cfg))
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ func (s *IntegrationTestSuite) TestGetQueryBondById() {
|
|||||||
{
|
{
|
||||||
"invalid bond id",
|
"invalid bond id",
|
||||||
[]string{
|
[]string{
|
||||||
fmt.Sprint("not_found_bond_id"),
|
"not_found_bond_id",
|
||||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
@ -246,7 +246,7 @@ func (s *IntegrationTestSuite) TestGetQueryBondListsByOwner() {
|
|||||||
{
|
{
|
||||||
"invalid owner address",
|
"invalid owner address",
|
||||||
[]string{
|
[]string{
|
||||||
fmt.Sprint("not_found_bond_id"),
|
"not_found_bond_id",
|
||||||
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
package testutil
|
package testutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
"github.com/tharsis/ethermint/testutil/network"
|
"github.com/tharsis/ethermint/testutil/network"
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIntegrationTestSuite(t *testing.T) {
|
func TestIntegrationTestSuite(t *testing.T) {
|
||||||
cfg := network.DefaultConfig()
|
cfg := network.DefaultConfig()
|
||||||
cfg.NumValidators = 1
|
cfg.NumValidators = 2
|
||||||
suite.Run(t, NewIntegrationTestSuite(cfg))
|
suite.Run(t, NewIntegrationTestSuite(cfg))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user