-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(systemtests): Remove testutil dependency (#21995)
Co-authored-by: marbar3778 <[email protected]> (cherry picked from commit 72f7716) # Conflicts: # tests/systemtests/bankv2_test.go # tests/systemtests/cometbft_client_test.go # tests/systemtests/snapshots_test.go
- Loading branch information
1 parent
a72390a
commit 9d6e69e
Showing
10 changed files
with
652 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
//go:build system_test | ||
|
||
package systemtests | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"github.com/tidwall/gjson" | ||
) | ||
|
||
func TestBankV2SendTxCmd(t *testing.T) { | ||
// Currently only run with app v2 | ||
if !isV2() { | ||
t.Skip() | ||
} | ||
// scenario: test bank send command | ||
// given a running chain | ||
|
||
sut.ResetChain(t) | ||
cli := NewCLIWrapper(t, sut, verbose) | ||
|
||
// get validator address | ||
valAddr := gjson.Get(cli.Keys("keys", "list"), "1.address").String() | ||
require.NotEmpty(t, valAddr) | ||
|
||
// add new key | ||
receiverAddr := cli.AddKey("account1") | ||
denom := "stake" | ||
sut.StartChain(t) | ||
|
||
// query validator balance and make sure it has enough balance | ||
var transferAmount int64 = 1000 | ||
raw := cli.CustomQuery("q", "bankv2", "balance", valAddr, denom) | ||
valBalance := gjson.Get(raw, "balance.amount").Int() | ||
|
||
require.Greater(t, valBalance, transferAmount, "not enough balance found with validator") | ||
|
||
bankSendCmdArgs := []string{"tx", "bankv2", "send", valAddr, receiverAddr, fmt.Sprintf("%d%s", transferAmount, denom)} | ||
|
||
// test valid transaction | ||
rsp := cli.Run(append(bankSendCmdArgs, "--fees=1stake")...) | ||
txResult, found := cli.AwaitTxCommitted(rsp) | ||
require.True(t, found) | ||
RequireTxSuccess(t, txResult) | ||
|
||
// Check balance after send | ||
valRaw := cli.CustomQuery("q", "bankv2", "balance", valAddr, denom) | ||
valBalanceAfer := gjson.Get(valRaw, "balance.amount").Int() | ||
|
||
// TODO: Make DeductFee ante handler work with bank/v2 | ||
require.Equal(t, valBalanceAfer, valBalance-transferAmount) | ||
|
||
receiverRaw := cli.CustomQuery("q", "bankv2", "balance", receiverAddr, denom) | ||
receiverBalance := gjson.Get(receiverRaw, "balance.amount").Int() | ||
require.Equal(t, receiverBalance, transferAmount) | ||
} |
Oops, something went wrong.