Fix Current Integration Tests (#6570)

* fix attempt

* fix test
This commit is contained in:
Alexander Bezobchuk
2020-07-01 18:37:59 +00:00
committed by GitHub
parent 2658175b01
commit 37cc04081e
10 changed files with 37 additions and 362 deletions
+1 -11
View File
@@ -141,8 +141,7 @@ func (f *Fixtures) KeysAddRecoverHDPath(name, mnemonic string, account uint32, i
// KeysShow is simcli keys show
func (f *Fixtures) KeysShow(name string, flags ...string) keyring.KeyOutput {
cmd := fmt.Sprintf("%s keys show --keyring-backend=test --home=%s %s", f.SimcliBinary,
f.SimcliHome, name)
cmd := fmt.Sprintf("%s keys show --keyring-backend=test --home=%s %s --output=json", f.SimcliBinary, f.SimcliHome, name)
out, _ := tests.ExecuteT(f.T, AddFlags(cmd, flags), "")
var ko keyring.KeyOutput
err := clientkeys.UnmarshalJSON([]byte(out), &ko)
@@ -173,15 +172,6 @@ func (f *Fixtures) QueryTxs(page, limit int, events ...string) *sdk.SearchTxsRes
return &result
}
//___________________________________________________________________________________
// simcli config
// CLIConfig is simcli config
func (f *Fixtures) CLIConfig(key, value string, flags ...string) {
cmd := fmt.Sprintf("%s config --home=%s %s %s", f.SimcliBinary, f.SimcliHome, key, value)
ExecuteWriteCheckErr(f.T, AddFlags(cmd, flags))
}
//utils
func AddFlags(cmd string, flags []string) string {
+2 -12
View File
@@ -17,8 +17,6 @@ func InitFixtures(t *testing.T) (f *Fixtures) {
// reset test state
f.UnsafeResetAll()
f.CLIConfig("keyring-backend", "test")
// ensure keystore has foo and bar keys
f.KeysDelete(KeyFoo)
f.KeysDelete(KeyBar)
@@ -28,19 +26,11 @@ func InitFixtures(t *testing.T) (f *Fixtures) {
f.KeysAdd(KeyBar)
f.KeysAdd(KeyBaz)
f.KeysAdd(KeyVesting)
f.KeysAdd(KeyFooBarBaz, "--multisig-threshold=2", fmt.Sprintf(
"--multisig=%s,%s,%s", KeyFoo, KeyBar, KeyBaz))
// ensure that CLI output is in JSON format
f.CLIConfig("output", "json")
f.KeysAdd(KeyFooBarBaz, "--multisig-threshold=2", fmt.Sprintf("--multisig=%s,%s,%s", KeyFoo, KeyBar, KeyBaz))
// NOTE: SDInit sets the ChainID
f.SDInit(KeyFoo)
f.CLIConfig("chain-id", f.ChainID)
f.CLIConfig("broadcast-mode", "block")
f.CLIConfig("trust-node", "true")
// start an account with tokens
f.AddGenesisAccount(f.KeyAddress(KeyFoo), StartCoins)
f.AddGenesisAccount(
@@ -66,5 +56,5 @@ func (f *Fixtures) Cleanup(dirs ...string) {
// Flags returns the flags necessary for making most CLI calls
func (f *Fixtures) Flags() string {
return fmt.Sprintf("--home=%s --node=%s", f.SimcliHome, f.RPCAddr)
return fmt.Sprintf("--home=%s --node=%s --chain-id=%s --output=json", f.SimcliHome, f.RPCAddr, f.ChainID)
}
-6
View File
@@ -33,9 +33,6 @@ func TestCLISimdCollectGentxs(t *testing.T) {
// Initialize keys
f.KeysAdd(cli.KeyFoo)
// Configure json output
f.CLIConfig("output", "json")
// Run init
f.SDInit(cli.KeyFoo)
@@ -80,9 +77,6 @@ func TestCLISimdAddGenesisAccount(t *testing.T) {
f.KeysAdd(cli.KeyBar)
f.KeysAdd(cli.KeyBaz)
// Configure json output
f.CLIConfig("output", "json")
// Run init
f.SDInit(cli.KeyFoo)