From d7a99aa0cf1873e0f29aa5337b5c8f4314b0c962 Mon Sep 17 00:00:00 2001 From: Luca Moser <moser.luca@gmail.com> Date: Sat, 13 Jun 2020 14:34:33 +0200 Subject: [PATCH] fixes some asserts --- .../tester/tests/consensus/consensus_test.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/integration-tests/tester/tests/consensus/consensus_test.go b/tools/integration-tests/tester/tests/consensus/consensus_test.go index 43e937f4..3dca33ca 100644 --- a/tools/integration-tests/tester/tests/consensus/consensus_test.go +++ b/tools/integration-tests/tester/tests/consensus/consensus_test.go @@ -9,6 +9,7 @@ import ( "github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/balance" "github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/transaction" "github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/wallet" + "github.com/iotaledger/goshimmer/plugins/webapi/value/utils" "github.com/iotaledger/goshimmer/tools/integration-tests/tester/tests" "github.com/mr-tron/base58/base58" "github.com/stretchr/testify/assert" @@ -47,12 +48,13 @@ func TestConsensusNoConflicts(t *testing.T) { }), ) tx = tx.Sign(signaturescheme.ED25519(*genesisWallet.Seed().KeyPair(0))) + utilsTx := utils.ParseTransaction(tx) txID, err := n.Peers()[0].SendTransaction(tx.Bytes()) require.NoError(t, err) // wait for the transaction to be propagated through the network - time.Sleep(10 * time.Second) + time.Sleep(20 * time.Second) // check that each node has the same perception for _, p := range n.Peers() { @@ -60,20 +62,22 @@ func TestConsensusNoConflicts(t *testing.T) { res, err := p.GetTransactionByID(txID) assert.NoError(t, err) assert.Len(t, res.Error, 0, "there shouldn't be any error from submitting the valid transaction") - assert.Len(t, res.Transaction.Inputs, 1) - assert.Equal(t, genesisOutputID.String(), res.Transaction.Inputs[0]) + assert.EqualValues(t, utilsTx.Inputs, res.Transaction.Inputs) + assert.EqualValues(t, utilsTx.Outputs, res.Transaction.Outputs) + assert.EqualValues(t, utilsTx.Signature, res.Transaction.Signature) // check that genesis UTXO is spent utxos, err := p.GetUnspentOutputs([]string{genesisAddr.String()}) assert.NoError(t, err) + assert.Len(t, utxos.Error, 0, "there shouldn't be any error from querying UTXOs") assert.Len(t, utxos.UnspentOutputs, 0, "genesis address should not have any UTXOs") // check UTXOs utxos, err = p.GetUnspentOutputs([]string{addr1.String(), addr2.String()}) assert.Len(t, utxos.UnspentOutputs, 2, "addresses should have UTXOs") assert.Equal(t, addr1.String(), utxos.UnspentOutputs[0].Address) - assert.Equal(t, deposit, utxos.UnspentOutputs[0].OutputIDs[0].Balances[0].Value) + assert.EqualValues(t, deposit, utxos.UnspentOutputs[0].OutputIDs[0].Balances[0].Value) assert.Equal(t, addr2.String(), utxos.UnspentOutputs[1].Address) - assert.Equal(t, deposit, utxos.UnspentOutputs[1].OutputIDs[0].Balances[0].Value) + assert.EqualValues(t, deposit, utxos.UnspentOutputs[1].OutputIDs[0].Balances[0].Value) } } -- GitLab