Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayashsatolia403 committed Sep 15, 2024
1 parent 3b9e9af commit e050fae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 3 additions & 1 deletion tests/cli_tests/zwalletcli_miner_stake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestMinerStake(testSetup *testing.T) {

poolsInfo, err := pollForPoolInfo(t, miner.ID)
require.Nil(t, err)
require.Equal(t, float64(2.0), intToZCN(poolsInfo.Balance))
require.Equal(t, 2.0, intToZCN(poolsInfo.Balance))

// Unlock should work
output, err = minerOrSharderUnlock(t, configPath, createParams(map[string]interface{}{
Expand Down Expand Up @@ -280,6 +280,8 @@ func pollForPoolInfo(t *test.SystemTest, minerID string) (climodel.DelegatePool,
t.Log(`polling for pool info till it is "ACTIVE"...`)
timeout := time.After(time.Minute * 5)

time.Sleep(10 * time.Second)

var poolsInfo climodel.DelegatePool
for {
output, err := minerSharderPoolInfo(t, configPath, createParams(map[string]interface{}{
Expand Down
13 changes: 5 additions & 8 deletions tests/cli_tests/zwalletcli_send_and_balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ import (
cliutils "github.com/0chain/system_test/internal/cli/util"
)

// address of minersc
const MINER_SC_ADDRESS = "6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9"

func TestSendAndBalance(testSetup *testing.T) {
t := test.NewSystemTest(testSetup)
t.SetSmokeTests("Send with description")
Expand Down Expand Up @@ -130,7 +127,7 @@ func TestSendAndBalance(testSetup *testing.T) {
target, err := getWalletForName(t, configPath, targetWallet)
require.Nil(t, err, "Error occurred when retrieving target wallet")

wantFailureMsg := `Send tokens failed. submit transaction failed. {"error":"insufficient balance to send"}`
wantFailureMsg := `Send tokens failed. submit transaction failed: {"error":"insufficient balance to send"}`

output, err := sendZCN(t, configPath, target.ClientID, "1", "", createParams(map[string]interface{}{}), false)
require.NotNil(t, err, "Expected send to fail", strings.Join(output, "\n"))
Expand All @@ -143,7 +140,7 @@ func TestSendAndBalance(testSetup *testing.T) {
createWallet(t)

invalidClientID := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabb" // more than 64 chars
wantFailureMsg := "Send tokens failed. submit transaction failed. {\"error\":\"invalid to client id\"}"
wantFailureMsg := "Send tokens failed. submit transaction failed: {\"error\":\"invalid to client id\"}"

output, err := sendZCN(t, configPath, invalidClientID, "1", "", createParams(map[string]interface{}{}), false)
require.NotNil(t, err, "Expected send to fail", strings.Join(output, "\n"))
Expand Down Expand Up @@ -183,7 +180,7 @@ func TestSendAndBalance(testSetup *testing.T) {
target, err := getWalletForName(t, configPath, targetWallet)
require.Nil(t, err, "Error occurred when retrieving target wallet")

wantFailureMsg := `Send tokens failed. submit transaction failed. {"error":"insufficient balance to send"}`
wantFailureMsg := `Send tokens failed. submit transaction failed: {"error":"insufficient balance to send"}`
tokens := strconv.Itoa(int(balance) + 1)

output, err := sendZCN(t, configPath, target.ClientID, tokens, "", createParams(map[string]interface{}{}), false)
Expand Down Expand Up @@ -228,7 +225,7 @@ func TestSendAndBalance(testSetup *testing.T) {
}
longDesc := string(b)

wantFailureMsg := "Send tokens failed. submit transaction failed. {\"code\":\"txn_exceed_max_payload\"," +
wantFailureMsg := "Send tokens failed. submit transaction failed: {\"code\":\"txn_exceed_max_payload\"," +
"\"error\":\"txn_exceed_max_payload: transaction payload exceeds the max payload (98304)\"}"

output, err := sendZCN(t, configPath, target.ClientID, "1", longDesc, createParams(map[string]interface{}{}), false)
Expand All @@ -244,7 +241,7 @@ func TestSendAndBalance(testSetup *testing.T) {
wallet, err := getWallet(t, configPath)
require.Nil(t, err, "Get wallet failed")

wantFailureMsg := "Send tokens failed. submit transaction failed. {\"code\":\"invalid_request\"," +
wantFailureMsg := "Send tokens failed. submit transaction failed: {\"code\":\"invalid_request\"," +
"\"error\":\"invalid_request: Invalid request (from and to client should be different)\"}"

output, err := sendZCN(t, configPath, wallet.ClientID, "1", "", createParams(map[string]interface{}{}), false)
Expand Down

0 comments on commit e050fae

Please sign in to comment.