update import and build paths

This commit is contained in:
rhuairahrighairigh 2019-06-25 13:50:25 +01:00
parent 3cb63349b2
commit 1de350c4e9
3 changed files with 75 additions and 63 deletions

View File

@ -19,11 +19,12 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
"github.com/cosmos/cosmos-sdk/tests" "github.com/cosmos/cosmos-sdk/tests"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov"
"github.com/kava-labs/kava/app"
) )
func TestGaiaCLIKeysAddMultisig(t *testing.T) { func TestGaiaCLIKeysAddMultisig(t *testing.T) {

View File

@ -1,3 +1,2 @@
// Package clitest runs integration tests which make use of CLI commands.
package clitest package clitest
// package clitest runs integration tests which make use of CLI commands.

View File

@ -3,6 +3,7 @@ package clitest
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"go/build"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
@ -15,8 +16,6 @@ import (
cmn "github.com/tendermint/tendermint/libs/common" cmn "github.com/tendermint/tendermint/libs/common"
clientkeys "github.com/cosmos/cosmos-sdk/client/keys" clientkeys "github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/cmd/gaia/app"
appInit "github.com/cosmos/cosmos-sdk/cmd/gaia/init"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys" "github.com/cosmos/cosmos-sdk/crypto/keys"
"github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server"
@ -26,6 +25,9 @@ import (
"github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov"
"github.com/cosmos/cosmos-sdk/x/slashing" "github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking" "github.com/cosmos/cosmos-sdk/x/staking"
"github.com/kava-labs/kava/app"
appInit "github.com/kava-labs/kava/init"
) )
const ( const (
@ -58,20 +60,28 @@ var (
// Fixtures is used to setup the testing environment // Fixtures is used to setup the testing environment
type Fixtures struct { type Fixtures struct {
ChainID string ChainID string
RPCAddr string RPCAddr string
Port string Port string
GDHome string AppDaemonBinary string
GCLIHome string AppCliBinary string
P2PAddr string GDHome string
T *testing.T GCLIHome string
P2PAddr string
T *testing.T
} }
// NewFixtures creates a new instance of Fixtures with many vars set // NewFixtures creates a new instance of Fixtures with many vars set
func NewFixtures(t *testing.T) *Fixtures { func NewFixtures(t *testing.T) *Fixtures {
tmpDir, err := ioutil.TempDir("", "gaia_integration_"+t.Name()+"_") tmpDir, err := ioutil.TempDir("", "kava_integration_"+t.Name()+"_")
require.NoError(t, err) require.NoError(t, err)
// set location of the app binaries
buildDir := os.Getenv("BUILDDIR")
if buildDir == "" {
buildDir = filepath.Join(build.Default.GOPATH, "bin")
}
servAddr, port, err := server.FreeTCPAddr() servAddr, port, err := server.FreeTCPAddr()
require.NoError(t, err) require.NoError(t, err)
@ -79,12 +89,14 @@ func NewFixtures(t *testing.T) *Fixtures {
require.NoError(t, err) require.NoError(t, err)
return &Fixtures{ return &Fixtures{
T: t, T: t,
GDHome: filepath.Join(tmpDir, ".gaiad"), AppDaemonBinary: filepath.Join(buildDir, "kvd"),
GCLIHome: filepath.Join(tmpDir, ".gaiacli"), AppCliBinary: filepath.Join(buildDir, "kvcli"),
RPCAddr: servAddr, GDHome: filepath.Join(tmpDir, ".kvd"),
P2PAddr: p2pAddr, GCLIHome: filepath.Join(tmpDir, ".kvcli"),
Port: port, RPCAddr: servAddr,
P2PAddr: p2pAddr,
Port: port,
} }
} }
@ -167,7 +179,7 @@ func (f *Fixtures) Flags() string {
// UnsafeResetAll is gaiad unsafe-reset-all // UnsafeResetAll is gaiad unsafe-reset-all
func (f *Fixtures) UnsafeResetAll(flags ...string) { func (f *Fixtures) UnsafeResetAll(flags ...string) {
cmd := fmt.Sprintf("../../../build/gaiad --home=%s unsafe-reset-all", f.GDHome) cmd := fmt.Sprintf("%s --home=%s unsafe-reset-all", f.AppDaemonBinary, f.GDHome)
executeWrite(f.T, addFlags(cmd, flags)) executeWrite(f.T, addFlags(cmd, flags))
err := os.RemoveAll(filepath.Join(f.GDHome, "config", "gentx")) err := os.RemoveAll(filepath.Join(f.GDHome, "config", "gentx"))
require.NoError(f.T, err) require.NoError(f.T, err)
@ -176,7 +188,7 @@ func (f *Fixtures) UnsafeResetAll(flags ...string) {
// GDInit is gaiad init // GDInit is gaiad init
// NOTE: GDInit sets the ChainID for the Fixtures instance // NOTE: GDInit sets the ChainID for the Fixtures instance
func (f *Fixtures) GDInit(moniker string, flags ...string) { func (f *Fixtures) GDInit(moniker string, flags ...string) {
cmd := fmt.Sprintf("../../../build/gaiad init -o --home=%s %s", f.GDHome, moniker) cmd := fmt.Sprintf("%s init -o --home=%s %s", f.AppDaemonBinary, f.GDHome, moniker)
_, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), app.DefaultKeyPass) _, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
var chainID string var chainID string
@ -193,25 +205,25 @@ func (f *Fixtures) GDInit(moniker string, flags ...string) {
// AddGenesisAccount is gaiad add-genesis-account // AddGenesisAccount is gaiad add-genesis-account
func (f *Fixtures) AddGenesisAccount(address sdk.AccAddress, coins sdk.Coins, flags ...string) { func (f *Fixtures) AddGenesisAccount(address sdk.AccAddress, coins sdk.Coins, flags ...string) {
cmd := fmt.Sprintf("../../../build/gaiad add-genesis-account %s %s --home=%s", address, coins, f.GDHome) cmd := fmt.Sprintf("%s add-genesis-account %s %s --home=%s", f.AppDaemonBinary, address, coins, f.GDHome)
executeWriteCheckErr(f.T, addFlags(cmd, flags)) executeWriteCheckErr(f.T, addFlags(cmd, flags))
} }
// GenTx is gaiad gentx // GenTx is gaiad gentx
func (f *Fixtures) GenTx(name string, flags ...string) { func (f *Fixtures) GenTx(name string, flags ...string) {
cmd := fmt.Sprintf("../../../build/gaiad gentx --name=%s --home=%s --home-client=%s", name, f.GDHome, f.GCLIHome) cmd := fmt.Sprintf("%s gentx --name=%s --home=%s --home-client=%s", f.AppDaemonBinary, name, f.GDHome, f.GCLIHome)
executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass) executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
// CollectGenTxs is gaiad collect-gentxs // CollectGenTxs is gaiad collect-gentxs
func (f *Fixtures) CollectGenTxs(flags ...string) { func (f *Fixtures) CollectGenTxs(flags ...string) {
cmd := fmt.Sprintf("../../../build/gaiad collect-gentxs --home=%s", f.GDHome) cmd := fmt.Sprintf("%s collect-gentxs --home=%s", f.AppDaemonBinary, f.GDHome)
executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass) executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
// GDStart runs gaiad start with the appropriate flags and returns a process // GDStart runs gaiad start with the appropriate flags and returns a process
func (f *Fixtures) GDStart(flags ...string) *tests.Process { func (f *Fixtures) GDStart(flags ...string) *tests.Process {
cmd := fmt.Sprintf("../../../build/gaiad start --home=%s --rpc.laddr=%v --p2p.laddr=%v", f.GDHome, f.RPCAddr, f.P2PAddr) cmd := fmt.Sprintf("%s start --home=%s --rpc.laddr=%v --p2p.laddr=%v", f.AppDaemonBinary, f.GDHome, f.RPCAddr, f.P2PAddr)
proc := tests.GoExecuteTWithStdout(f.T, addFlags(cmd, flags)) proc := tests.GoExecuteTWithStdout(f.T, addFlags(cmd, flags))
tests.WaitForTMStart(f.Port) tests.WaitForTMStart(f.Port)
tests.WaitForNextNBlocksTM(1, f.Port) tests.WaitForNextNBlocksTM(1, f.Port)
@ -220,7 +232,7 @@ func (f *Fixtures) GDStart(flags ...string) *tests.Process {
// GDTendermint returns the results of gaiad tendermint [query] // GDTendermint returns the results of gaiad tendermint [query]
func (f *Fixtures) GDTendermint(query string) string { func (f *Fixtures) GDTendermint(query string) string {
cmd := fmt.Sprintf("../../../build/gaiad tendermint %s --home=%s", query, f.GDHome) cmd := fmt.Sprintf("%s tendermint %s --home=%s", f.AppDaemonBinary, query, f.GDHome)
success, stdout, stderr := executeWriteRetStdStreams(f.T, cmd) success, stdout, stderr := executeWriteRetStdStreams(f.T, cmd)
require.Empty(f.T, stderr) require.Empty(f.T, stderr)
require.True(f.T, success) require.True(f.T, success)
@ -229,7 +241,7 @@ func (f *Fixtures) GDTendermint(query string) string {
// ValidateGenesis runs gaiad validate-genesis // ValidateGenesis runs gaiad validate-genesis
func (f *Fixtures) ValidateGenesis() { func (f *Fixtures) ValidateGenesis() {
cmd := fmt.Sprintf("../../../build/gaiad validate-genesis --home=%s", f.GDHome) cmd := fmt.Sprintf("%s validate-genesis --home=%s", f.AppDaemonBinary, f.GDHome)
executeWriteCheckErr(f.T, cmd) executeWriteCheckErr(f.T, cmd)
} }
@ -238,31 +250,31 @@ func (f *Fixtures) ValidateGenesis() {
// KeysDelete is gaiacli keys delete // KeysDelete is gaiacli keys delete
func (f *Fixtures) KeysDelete(name string, flags ...string) { func (f *Fixtures) KeysDelete(name string, flags ...string) {
cmd := fmt.Sprintf("../../../build/gaiacli keys delete --home=%s %s", f.GCLIHome, name) cmd := fmt.Sprintf("%s keys delete --home=%s %s", f.AppCliBinary, f.GCLIHome, name)
executeWrite(f.T, addFlags(cmd, append(append(flags, "-y"), "-f"))) executeWrite(f.T, addFlags(cmd, append(append(flags, "-y"), "-f")))
} }
// KeysAdd is gaiacli keys add // KeysAdd is gaiacli keys add
func (f *Fixtures) KeysAdd(name string, flags ...string) { func (f *Fixtures) KeysAdd(name string, flags ...string) {
cmd := fmt.Sprintf("../../../build/gaiacli keys add --home=%s %s", f.GCLIHome, name) cmd := fmt.Sprintf("%s keys add --home=%s %s", f.AppCliBinary, f.GCLIHome, name)
executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass) executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
// KeysAddRecover prepares gaiacli keys add --recover // KeysAddRecover prepares gaiacli keys add --recover
func (f *Fixtures) KeysAddRecover(name, mnemonic string, flags ...string) (exitSuccess bool, stdout, stderr string) { func (f *Fixtures) KeysAddRecover(name, mnemonic string, flags ...string) (exitSuccess bool, stdout, stderr string) {
cmd := fmt.Sprintf("../../../build/gaiacli keys add --home=%s --recover %s", f.GCLIHome, name) cmd := fmt.Sprintf("%s keys add --home=%s --recover %s", f.AppCliBinary, f.GCLIHome, name)
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass, mnemonic) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass, mnemonic)
} }
// KeysAddRecoverHDPath prepares gaiacli keys add --recover --account --index // KeysAddRecoverHDPath prepares gaiacli keys add --recover --account --index
func (f *Fixtures) KeysAddRecoverHDPath(name, mnemonic string, account uint32, index uint32, flags ...string) { func (f *Fixtures) KeysAddRecoverHDPath(name, mnemonic string, account uint32, index uint32, flags ...string) {
cmd := fmt.Sprintf("../../../build/gaiacli keys add --home=%s --recover %s --account %d --index %d", f.GCLIHome, name, account, index) cmd := fmt.Sprintf("%s keys add --home=%s --recover %s --account %d --index %d", f.AppCliBinary, f.GCLIHome, name, account, index)
executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass, mnemonic) executeWriteCheckErr(f.T, addFlags(cmd, flags), app.DefaultKeyPass, mnemonic)
} }
// KeysShow is gaiacli keys show // KeysShow is gaiacli keys show
func (f *Fixtures) KeysShow(name string, flags ...string) keys.KeyOutput { func (f *Fixtures) KeysShow(name string, flags ...string) keys.KeyOutput {
cmd := fmt.Sprintf("../../../build/gaiacli keys show --home=%s %s", f.GCLIHome, name) cmd := fmt.Sprintf("%s keys show --home=%s %s", f.AppCliBinary, f.GCLIHome, name)
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var ko keys.KeyOutput var ko keys.KeyOutput
err := clientkeys.UnmarshalJSON([]byte(out), &ko) err := clientkeys.UnmarshalJSON([]byte(out), &ko)
@ -283,7 +295,7 @@ func (f *Fixtures) KeyAddress(name string) sdk.AccAddress {
// CLIConfig is gaiacli config // CLIConfig is gaiacli config
func (f *Fixtures) CLIConfig(key, value string, flags ...string) { func (f *Fixtures) CLIConfig(key, value string, flags ...string) {
cmd := fmt.Sprintf("../../../build/gaiacli config --home=%s %s %s", f.GCLIHome, key, value) cmd := fmt.Sprintf("%s config --home=%s %s %s", f.AppCliBinary, f.GCLIHome, key, value)
executeWriteCheckErr(f.T, addFlags(cmd, flags)) executeWriteCheckErr(f.T, addFlags(cmd, flags))
} }
@ -292,7 +304,7 @@ func (f *Fixtures) CLIConfig(key, value string, flags ...string) {
// TxSend is gaiacli tx send // TxSend is gaiacli tx send
func (f *Fixtures) TxSend(from string, to sdk.AccAddress, amount sdk.Coin, flags ...string) (bool, string, string) { func (f *Fixtures) TxSend(from string, to sdk.AccAddress, amount sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("../../../build/gaiacli tx send %s %s %v --from=%s", to, amount, f.Flags(), from) cmd := fmt.Sprintf("%s tx send %s %s %v --from=%s", f.AppCliBinary, to, amount, f.Flags(), from)
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
@ -300,25 +312,25 @@ func (f *Fixtures) txSendWithConfirm(
from string, to sdk.AccAddress, amount sdk.Coin, confirm string, flags ...string, from string, to sdk.AccAddress, amount sdk.Coin, confirm string, flags ...string,
) (bool, string, string) { ) (bool, string, string) {
cmd := fmt.Sprintf("../../../build/gaiacli tx send %s %s %v --from=%s", to, amount, f.Flags(), from) cmd := fmt.Sprintf("%s tx send %s %s %v --from=%s", f.AppCliBinary, to, amount, f.Flags(), from)
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), confirm, app.DefaultKeyPass) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), confirm, app.DefaultKeyPass)
} }
// TxSign is gaiacli tx sign // TxSign is gaiacli tx sign
func (f *Fixtures) TxSign(signer, fileName string, flags ...string) (bool, string, string) { func (f *Fixtures) TxSign(signer, fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("../../../build/gaiacli tx sign %v --from=%s %v", f.Flags(), signer, fileName) cmd := fmt.Sprintf("%s tx sign %v --from=%s %v", f.AppCliBinary, f.Flags(), signer, fileName)
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
// TxBroadcast is gaiacli tx broadcast // TxBroadcast is gaiacli tx broadcast
func (f *Fixtures) TxBroadcast(fileName string, flags ...string) (bool, string, string) { func (f *Fixtures) TxBroadcast(fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("../../../build/gaiacli tx broadcast %v %v", f.Flags(), fileName) cmd := fmt.Sprintf("%s tx broadcast %v %v", f.AppCliBinary, f.Flags(), fileName)
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
// TxEncode is gaiacli tx encode // TxEncode is gaiacli tx encode
func (f *Fixtures) TxEncode(fileName string, flags ...string) (bool, string, string) { func (f *Fixtures) TxEncode(fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("../../../build/gaiacli tx encode %v %v", f.Flags(), fileName) cmd := fmt.Sprintf("%s tx encode %v %v", f.AppCliBinary, f.Flags(), fileName)
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
@ -326,7 +338,7 @@ func (f *Fixtures) TxEncode(fileName string, flags ...string) (bool, string, str
func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string, func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string,
flags ...string) (bool, string, string) { flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("../../../build/gaiacli tx multisign %v %s %s %s", f.Flags(), cmd := fmt.Sprintf("%s tx multisign %v %s %s %s", f.AppCliBinary, f.Flags(),
fileName, name, strings.Join(signaturesFiles, " "), fileName, name, strings.Join(signaturesFiles, " "),
) )
return executeWriteRetStdStreams(f.T, cmd) return executeWriteRetStdStreams(f.T, cmd)
@ -337,7 +349,7 @@ func (f *Fixtures) TxMultisign(fileName, name string, signaturesFiles []string,
// TxStakingCreateValidator is gaiacli tx staking create-validator // TxStakingCreateValidator is gaiacli tx staking create-validator
func (f *Fixtures) TxStakingCreateValidator(from, consPubKey string, amount sdk.Coin, flags ...string) (bool, string, string) { func (f *Fixtures) TxStakingCreateValidator(from, consPubKey string, amount sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("../../../build/gaiacli tx staking create-validator %v --from=%s --pubkey=%s", f.Flags(), from, consPubKey) cmd := fmt.Sprintf("%s tx staking create-validator %v --from=%s --pubkey=%s", f.AppCliBinary, f.Flags(), from, consPubKey)
cmd += fmt.Sprintf(" --amount=%v --moniker=%v --commission-rate=%v", amount, from, "0.05") cmd += fmt.Sprintf(" --amount=%v --moniker=%v --commission-rate=%v", amount, from, "0.05")
cmd += fmt.Sprintf(" --commission-max-rate=%v --commission-max-change-rate=%v", "0.20", "0.10") cmd += fmt.Sprintf(" --commission-max-rate=%v --commission-max-change-rate=%v", "0.20", "0.10")
cmd += fmt.Sprintf(" --min-self-delegation=%v", "1") cmd += fmt.Sprintf(" --min-self-delegation=%v", "1")
@ -346,7 +358,7 @@ func (f *Fixtures) TxStakingCreateValidator(from, consPubKey string, amount sdk.
// TxStakingUnbond is gaiacli tx staking unbond // TxStakingUnbond is gaiacli tx staking unbond
func (f *Fixtures) TxStakingUnbond(from, shares string, validator sdk.ValAddress, flags ...string) bool { func (f *Fixtures) TxStakingUnbond(from, shares string, validator sdk.ValAddress, flags ...string) bool {
cmd := fmt.Sprintf("../../../build/gaiacli tx staking unbond %s %v --from=%s %v", validator, shares, from, f.Flags()) cmd := fmt.Sprintf("%s tx staking unbond %s %v --from=%s %v", f.AppCliBinary, validator, shares, from, f.Flags())
return executeWrite(f.T, addFlags(cmd, flags), app.DefaultKeyPass) return executeWrite(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
@ -355,20 +367,20 @@ func (f *Fixtures) TxStakingUnbond(from, shares string, validator sdk.ValAddress
// TxGovSubmitProposal is gaiacli tx gov submit-proposal // TxGovSubmitProposal is gaiacli tx gov submit-proposal
func (f *Fixtures) TxGovSubmitProposal(from, typ, title, description string, deposit sdk.Coin, flags ...string) (bool, string, string) { func (f *Fixtures) TxGovSubmitProposal(from, typ, title, description string, deposit sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("../../../build/gaiacli tx gov submit-proposal %v --from=%s --type=%s", f.Flags(), from, typ) cmd := fmt.Sprintf("%s tx gov submit-proposal %v --from=%s --type=%s", f.AppCliBinary, f.Flags(), from, typ)
cmd += fmt.Sprintf(" --title=%s --description=%s --deposit=%s", title, description, deposit) cmd += fmt.Sprintf(" --title=%s --description=%s --deposit=%s", title, description, deposit)
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
// TxGovDeposit is gaiacli tx gov deposit // TxGovDeposit is gaiacli tx gov deposit
func (f *Fixtures) TxGovDeposit(proposalID int, from string, amount sdk.Coin, flags ...string) (bool, string, string) { func (f *Fixtures) TxGovDeposit(proposalID int, from string, amount sdk.Coin, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("../../../build/gaiacli tx gov deposit %d %s --from=%s %v", proposalID, amount, from, f.Flags()) cmd := fmt.Sprintf("%s tx gov deposit %d %s --from=%s %v", f.AppCliBinary, proposalID, amount, from, f.Flags())
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
// TxGovVote is gaiacli tx gov vote // TxGovVote is gaiacli tx gov vote
func (f *Fixtures) TxGovVote(proposalID int, option gov.VoteOption, from string, flags ...string) (bool, string, string) { func (f *Fixtures) TxGovVote(proposalID int, option gov.VoteOption, from string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("../../../build/gaiacli tx gov vote %d %s --from=%s %v", proposalID, option, from, f.Flags()) cmd := fmt.Sprintf("%s tx gov vote %d %s --from=%s %v", f.AppCliBinary, proposalID, option, from, f.Flags())
return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass) return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), app.DefaultKeyPass)
} }
@ -377,7 +389,7 @@ func (f *Fixtures) TxGovVote(proposalID int, option gov.VoteOption, from string,
// QueryAccount is gaiacli query account // QueryAccount is gaiacli query account
func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) auth.BaseAccount { func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) auth.BaseAccount {
cmd := fmt.Sprintf("../../../build/gaiacli query account %s %v", address, f.Flags()) cmd := fmt.Sprintf("%s query account %s %v", f.AppCliBinary, address, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var initRes map[string]json.RawMessage var initRes map[string]json.RawMessage
err := json.Unmarshal([]byte(out), &initRes) err := json.Unmarshal([]byte(out), &initRes)
@ -396,7 +408,7 @@ func (f *Fixtures) QueryAccount(address sdk.AccAddress, flags ...string) auth.Ba
// QueryTxs is gaiacli query txs // QueryTxs is gaiacli query txs
func (f *Fixtures) QueryTxs(page, limit int, tags ...string) []sdk.TxResponse { func (f *Fixtures) QueryTxs(page, limit int, tags ...string) []sdk.TxResponse {
cmd := fmt.Sprintf("../../../build/gaiacli query txs --page=%d --limit=%d --tags='%s' %v", page, limit, queryTags(tags), f.Flags()) cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --tags='%s' %v", f.AppCliBinary, page, limit, queryTags(tags), f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "") out, _ := tests.ExecuteT(f.T, cmd, "")
var txs []sdk.TxResponse var txs []sdk.TxResponse
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -407,7 +419,7 @@ func (f *Fixtures) QueryTxs(page, limit int, tags ...string) []sdk.TxResponse {
// QueryTxsInvalid query txs with wrong parameters and compare expected error // QueryTxsInvalid query txs with wrong parameters and compare expected error
func (f *Fixtures) QueryTxsInvalid(expectedErr error, page, limit int, tags ...string) { func (f *Fixtures) QueryTxsInvalid(expectedErr error, page, limit int, tags ...string) {
cmd := fmt.Sprintf("../../../build/gaiacli query txs --page=%d --limit=%d --tags='%s' %v", page, limit, queryTags(tags), f.Flags()) cmd := fmt.Sprintf("%s query txs --page=%d --limit=%d --tags='%s' %v", f.AppCliBinary, page, limit, queryTags(tags), f.Flags())
_, err := tests.ExecuteT(f.T, cmd, "") _, err := tests.ExecuteT(f.T, cmd, "")
require.EqualError(f.T, expectedErr, err) require.EqualError(f.T, expectedErr, err)
} }
@ -417,7 +429,7 @@ func (f *Fixtures) QueryTxsInvalid(expectedErr error, page, limit int, tags ...s
// QueryStakingValidator is gaiacli query staking validator // QueryStakingValidator is gaiacli query staking validator
func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string) staking.Validator { func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string) staking.Validator {
cmd := fmt.Sprintf("../../../build/gaiacli query staking validator %s %v", valAddr, f.Flags()) cmd := fmt.Sprintf("%s query staking validator %s %v", f.AppCliBinary, valAddr, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var validator staking.Validator var validator staking.Validator
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -428,7 +440,7 @@ func (f *Fixtures) QueryStakingValidator(valAddr sdk.ValAddress, flags ...string
// QueryStakingUnbondingDelegationsFrom is gaiacli query staking unbonding-delegations-from // QueryStakingUnbondingDelegationsFrom is gaiacli query staking unbonding-delegations-from
func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress, flags ...string) []staking.UnbondingDelegation { func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress, flags ...string) []staking.UnbondingDelegation {
cmd := fmt.Sprintf("../../../build/gaiacli query staking unbonding-delegations-from %s %v", valAddr, f.Flags()) cmd := fmt.Sprintf("%s query staking unbonding-delegations-from %s %v", f.AppCliBinary, valAddr, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var ubds []staking.UnbondingDelegation var ubds []staking.UnbondingDelegation
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -439,7 +451,7 @@ func (f *Fixtures) QueryStakingUnbondingDelegationsFrom(valAddr sdk.ValAddress,
// QueryStakingDelegationsTo is gaiacli query staking delegations-to // QueryStakingDelegationsTo is gaiacli query staking delegations-to
func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...string) []staking.Delegation { func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...string) []staking.Delegation {
cmd := fmt.Sprintf("../../../build/gaiacli query staking delegations-to %s %v", valAddr, f.Flags()) cmd := fmt.Sprintf("%s query staking delegations-to %s %v", f.AppCliBinary, valAddr, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var delegations []staking.Delegation var delegations []staking.Delegation
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -450,7 +462,7 @@ func (f *Fixtures) QueryStakingDelegationsTo(valAddr sdk.ValAddress, flags ...st
// QueryStakingPool is gaiacli query staking pool // QueryStakingPool is gaiacli query staking pool
func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool { func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool {
cmd := fmt.Sprintf("../../../build/gaiacli query staking pool %v", f.Flags()) cmd := fmt.Sprintf("%s query staking pool %v", f.AppCliBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var pool staking.Pool var pool staking.Pool
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -461,7 +473,7 @@ func (f *Fixtures) QueryStakingPool(flags ...string) staking.Pool {
// QueryStakingParameters is gaiacli query staking parameters // QueryStakingParameters is gaiacli query staking parameters
func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params { func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params {
cmd := fmt.Sprintf("../../../build/gaiacli query staking params %v", f.Flags()) cmd := fmt.Sprintf("%s query staking params %v", f.AppCliBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var params staking.Params var params staking.Params
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -475,7 +487,7 @@ func (f *Fixtures) QueryStakingParameters(flags ...string) staking.Params {
// QueryGovParamDeposit is gaiacli query gov param deposit // QueryGovParamDeposit is gaiacli query gov param deposit
func (f *Fixtures) QueryGovParamDeposit() gov.DepositParams { func (f *Fixtures) QueryGovParamDeposit() gov.DepositParams {
cmd := fmt.Sprintf("../../../build/gaiacli query gov param deposit %s", f.Flags()) cmd := fmt.Sprintf("%s query gov param deposit %s", f.AppCliBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "") out, _ := tests.ExecuteT(f.T, cmd, "")
var depositParam gov.DepositParams var depositParam gov.DepositParams
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -486,7 +498,7 @@ func (f *Fixtures) QueryGovParamDeposit() gov.DepositParams {
// QueryGovParamVoting is gaiacli query gov param voting // QueryGovParamVoting is gaiacli query gov param voting
func (f *Fixtures) QueryGovParamVoting() gov.VotingParams { func (f *Fixtures) QueryGovParamVoting() gov.VotingParams {
cmd := fmt.Sprintf("../../../build/gaiacli query gov param voting %s", f.Flags()) cmd := fmt.Sprintf("%s query gov param voting %s", f.AppCliBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "") out, _ := tests.ExecuteT(f.T, cmd, "")
var votingParam gov.VotingParams var votingParam gov.VotingParams
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -497,7 +509,7 @@ func (f *Fixtures) QueryGovParamVoting() gov.VotingParams {
// QueryGovParamTallying is gaiacli query gov param tallying // QueryGovParamTallying is gaiacli query gov param tallying
func (f *Fixtures) QueryGovParamTallying() gov.TallyParams { func (f *Fixtures) QueryGovParamTallying() gov.TallyParams {
cmd := fmt.Sprintf("../../../build/gaiacli query gov param tallying %s", f.Flags()) cmd := fmt.Sprintf("%s query gov param tallying %s", f.AppCliBinary, f.Flags())
out, _ := tests.ExecuteT(f.T, cmd, "") out, _ := tests.ExecuteT(f.T, cmd, "")
var tallyingParam gov.TallyParams var tallyingParam gov.TallyParams
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -508,7 +520,7 @@ func (f *Fixtures) QueryGovParamTallying() gov.TallyParams {
// QueryGovProposals is gaiacli query gov proposals // QueryGovProposals is gaiacli query gov proposals
func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals { func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals {
cmd := fmt.Sprintf("../../../build/gaiacli query gov proposals %v", f.Flags()) cmd := fmt.Sprintf("%s query gov proposals %v", f.AppCliBinary, f.Flags())
stdout, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), "") stdout, stderr := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
if strings.Contains(stderr, "No matching proposals found") { if strings.Contains(stderr, "No matching proposals found") {
return gov.Proposals{} return gov.Proposals{}
@ -523,7 +535,7 @@ func (f *Fixtures) QueryGovProposals(flags ...string) gov.Proposals {
// QueryGovProposal is gaiacli query gov proposal // QueryGovProposal is gaiacli query gov proposal
func (f *Fixtures) QueryGovProposal(proposalID int, flags ...string) gov.Proposal { func (f *Fixtures) QueryGovProposal(proposalID int, flags ...string) gov.Proposal {
cmd := fmt.Sprintf("../../../build/gaiacli query gov proposal %d %v", proposalID, f.Flags()) cmd := fmt.Sprintf("%s query gov proposal %d %v", f.AppCliBinary, proposalID, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var proposal gov.Proposal var proposal gov.Proposal
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -534,7 +546,7 @@ func (f *Fixtures) QueryGovProposal(proposalID int, flags ...string) gov.Proposa
// QueryGovVote is gaiacli query gov vote // QueryGovVote is gaiacli query gov vote
func (f *Fixtures) QueryGovVote(proposalID int, voter sdk.AccAddress, flags ...string) gov.Vote { func (f *Fixtures) QueryGovVote(proposalID int, voter sdk.AccAddress, flags ...string) gov.Vote {
cmd := fmt.Sprintf("../../../build/gaiacli query gov vote %d %s %v", proposalID, voter, f.Flags()) cmd := fmt.Sprintf("%s query gov vote %d %s %v", f.AppCliBinary, proposalID, voter, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var vote gov.Vote var vote gov.Vote
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -545,7 +557,7 @@ func (f *Fixtures) QueryGovVote(proposalID int, voter sdk.AccAddress, flags ...s
// QueryGovVotes is gaiacli query gov votes // QueryGovVotes is gaiacli query gov votes
func (f *Fixtures) QueryGovVotes(proposalID int, flags ...string) []gov.Vote { func (f *Fixtures) QueryGovVotes(proposalID int, flags ...string) []gov.Vote {
cmd := fmt.Sprintf("../../../build/gaiacli query gov votes %d %v", proposalID, f.Flags()) cmd := fmt.Sprintf("%s query gov votes %d %v", f.AppCliBinary, proposalID, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var votes []gov.Vote var votes []gov.Vote
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -556,7 +568,7 @@ func (f *Fixtures) QueryGovVotes(proposalID int, flags ...string) []gov.Vote {
// QueryGovDeposit is gaiacli query gov deposit // QueryGovDeposit is gaiacli query gov deposit
func (f *Fixtures) QueryGovDeposit(proposalID int, depositor sdk.AccAddress, flags ...string) gov.Deposit { func (f *Fixtures) QueryGovDeposit(proposalID int, depositor sdk.AccAddress, flags ...string) gov.Deposit {
cmd := fmt.Sprintf("../../../build/gaiacli query gov deposit %d %s %v", proposalID, depositor, f.Flags()) cmd := fmt.Sprintf("%s query gov deposit %d %s %v", f.AppCliBinary, proposalID, depositor, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var deposit gov.Deposit var deposit gov.Deposit
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -567,7 +579,7 @@ func (f *Fixtures) QueryGovDeposit(proposalID int, depositor sdk.AccAddress, fla
// QueryGovDeposits is gaiacli query gov deposits // QueryGovDeposits is gaiacli query gov deposits
func (f *Fixtures) QueryGovDeposits(propsalID int, flags ...string) []gov.Deposit { func (f *Fixtures) QueryGovDeposits(propsalID int, flags ...string) []gov.Deposit {
cmd := fmt.Sprintf("../../../build/gaiacli query gov deposits %d %v", propsalID, f.Flags()) cmd := fmt.Sprintf("%s query gov deposits %d %v", f.AppCliBinary, propsalID, f.Flags())
out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "") out, _ := tests.ExecuteT(f.T, addFlags(cmd, flags), "")
var deposits []gov.Deposit var deposits []gov.Deposit
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -581,7 +593,7 @@ func (f *Fixtures) QueryGovDeposits(propsalID int, flags ...string) []gov.Deposi
// QuerySigningInfo returns the signing info for a validator // QuerySigningInfo returns the signing info for a validator
func (f *Fixtures) QuerySigningInfo(val string) slashing.ValidatorSigningInfo { func (f *Fixtures) QuerySigningInfo(val string) slashing.ValidatorSigningInfo {
cmd := fmt.Sprintf("../../../build/gaiacli query slashing signing-info %s %s", val, f.Flags()) cmd := fmt.Sprintf("%s query slashing signing-info %s %s", f.AppCliBinary, val, f.Flags())
res, errStr := tests.ExecuteT(f.T, cmd, "") res, errStr := tests.ExecuteT(f.T, cmd, "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
cdc := app.MakeCodec() cdc := app.MakeCodec()
@ -593,7 +605,7 @@ func (f *Fixtures) QuerySigningInfo(val string) slashing.ValidatorSigningInfo {
// QuerySlashingParams is gaiacli query slashing params // QuerySlashingParams is gaiacli query slashing params
func (f *Fixtures) QuerySlashingParams() slashing.Params { func (f *Fixtures) QuerySlashingParams() slashing.Params {
cmd := fmt.Sprintf("../../../build/gaiacli query slashing params %s", f.Flags()) cmd := fmt.Sprintf("%s query slashing params %s", f.AppCliBinary, f.Flags())
res, errStr := tests.ExecuteT(f.T, cmd, "") res, errStr := tests.ExecuteT(f.T, cmd, "")
require.Empty(f.T, errStr) require.Empty(f.T, errStr)
cdc := app.MakeCodec() cdc := app.MakeCodec()