From 565ef748040cd6808585268ba6937578142567eb Mon Sep 17 00:00:00 2001 From: Julian Toledano Date: Wed, 22 Jan 2025 13:39:25 +0100 Subject: [PATCH] rabbit suggestions --- .golangci.yml | 3 --- tests/systemtests/accounts_test.go | 8 +++++++- tests/systemtests/rosetta.go | 6 ++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 973891a..cc5e4f9 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -52,9 +52,6 @@ issues: - text: "leading space" linters: - nolintlint - - text: "G204:" - linters: - - "gosec" max-issues-per-linter: 10000 max-same-issues: 10000 diff --git a/tests/systemtests/accounts_test.go b/tests/systemtests/accounts_test.go index 17d829a..a3d8775 100644 --- a/tests/systemtests/accounts_test.go +++ b/tests/systemtests/accounts_test.go @@ -22,7 +22,8 @@ func TestAccounts(t *testing.T) { toAddr := cli.AddKey("account2") sut.StartChain(t) - cli.RunAndWait("tx", "bank", "send", fromAddr, toAddr, "1000000stake") + rsp := cli.RunAndWait("tx", "bank", "send", fromAddr, toAddr, "1000000stake") + systemtests.RequireTxSuccess(t, rsp) rosetta.restart(t) rosettaRest := newRestClient(rosetta) @@ -32,6 +33,11 @@ func TestAccounts(t *testing.T) { assert.NoError(t, err) assert.Equal(t, int64(8999999), gjson.GetBytes(res, "balances.0.value").Int()) + // check recipient's balance after receiving tokens + res, err = rosettaRest.accountBalance(toAddr) + assert.NoError(t, err) + assert.Equal(t, int64(1000000), gjson.GetBytes(res, "balances.0.value").Int()) + // check balance at genesis, before spent res, err = rosettaRest.accountBalance(fromAddr, withBlockIdentifier("1")) assert.NoError(t, err) diff --git a/tests/systemtests/rosetta.go b/tests/systemtests/rosetta.go index 411cce4..1ca42fc 100644 --- a/tests/systemtests/rosetta.go +++ b/tests/systemtests/rosetta.go @@ -82,6 +82,7 @@ func (r *rosettaRunner) start(t *testing.T) { r.log("Start Rosetta\n") r.logf("Execute `%s %s`\n", r.execBinary, strings.Join(args, " ")) + // #nosec G204 cmd := exec.Command(locateExecutable(r.execBinary), args...) cmd.Dir = r.outputDir r.watchLogs(cmd) @@ -103,8 +104,9 @@ func (r *rosettaRunner) awaitRosettaUp(t *testing.T) { SetBody("{}"). Post("/network/list") if err == nil { - bk := gjson.GetBytes(res.Body(), "network_identifiers.#.blockchain").Array()[0].String() - require.Equal(t, bk, "testing") + result := gjson.GetBytes(res.Body(), "network_identifiers.#.blockchain").Array() + assert.Greater(t, len(result), 0) + require.Equal(t, result[0].String(), "testing") t.Log("Rosetta has been started\n") return }