From 22c1355d82566796fd4e5fb9abd648824639a8e7 Mon Sep 17 00:00:00 2001 From: muXxer Date: Fri, 3 May 2024 13:00:00 +0200 Subject: [PATCH] Add more detailed tx error messages in docker test framework --- go.mod | 2 +- go.sum | 4 ++-- tools/docker-network/tests/utils.go | 9 ++++++--- tools/gendoc/go.mod | 2 +- tools/gendoc/go.sum | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index f0483172b..b9e63ff97 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/iotaledger/hive.go/stringify v0.0.0-20240425095808-113b21573349 github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240425100742-5c85b6d16701 github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240425100432-05e1bf8fc089 - github.com/iotaledger/iota.go/v4 v4.0.0-20240425100055-540c74851d65 + github.com/iotaledger/iota.go/v4 v4.0.0-20240503105040-c86882e71808 github.com/labstack/echo/v4 v4.12.0 github.com/labstack/gommon v0.4.2 github.com/libp2p/go-libp2p v0.33.2 diff --git a/go.sum b/go.sum index 0b4a86a70..588c3cdc7 100644 --- a/go.sum +++ b/go.sum @@ -327,8 +327,8 @@ github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240425100432-05e1bf8fc089 h1:+NRPSb github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240425100432-05e1bf8fc089/go.mod h1:+iSOmdi7LSd1pXMThZsQk4YDbCSlvVomJUqbRhp3+Nk= github.com/iotaledger/iota-crypto-demo v0.0.0-20240419094816-40260bb800f7 h1:R7ogCKTQ2D5SfVoE6n9GQUsKwm4dcxqwnU863JVlVbw= github.com/iotaledger/iota-crypto-demo v0.0.0-20240419094816-40260bb800f7/go.mod h1:ntqq5J5Fu2SijiqPsjjdFkMm96UhGU/K0z3j6ARpHec= -github.com/iotaledger/iota.go/v4 v4.0.0-20240425100055-540c74851d65 h1:cKn39WbYZrBbGIeK5SZyu1Eukh1IOq8ZdBh7jC2/9Gg= -github.com/iotaledger/iota.go/v4 v4.0.0-20240425100055-540c74851d65/go.mod h1:2/gBFmGlXzZLcpOqTQTl2GqXtoe/aec6Fu9QTooQPZQ= +github.com/iotaledger/iota.go/v4 v4.0.0-20240503105040-c86882e71808 h1:ruI9Xk8g4xbCFsXBBvIXkOi03WprGJyHkmERGSizFTk= +github.com/iotaledger/iota.go/v4 v4.0.0-20240503105040-c86882e71808/go.mod h1:2/gBFmGlXzZLcpOqTQTl2GqXtoe/aec6Fu9QTooQPZQ= github.com/ipfs/boxo v0.19.0 h1:UbX9FBJQF19ACLqRZOgdEla6jR/sC4H1O+iGE0NToXA= github.com/ipfs/boxo v0.19.0/go.mod h1:V5gJzbIMwKEXrg3IdvAxIdF7UPgU4RsXmNGS8MQ/0D4= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/tools/docker-network/tests/utils.go b/tools/docker-network/tests/utils.go index f8870fd1a..268f3ef7e 100644 --- a/tools/docker-network/tests/utils.go +++ b/tools/docker-network/tests/utils.go @@ -220,7 +220,7 @@ func (d *DockerTestFramework) AwaitTransactionPayloadAccepted(ctx context.Contex } } - return ierrors.Errorf("transaction %s is pending or having errors, state: %s, failure reason: %d", txID.ToHex(), resp.TransactionState.String(), resp.TransactionFailureReason) + return ierrors.Errorf("transaction %s is pending or having errors, state: %s, failure reason: %s, failure details: %s", txID.ToHex(), resp.TransactionState, resp.TransactionFailureReason, resp.TransactionFailureDetails) }) } @@ -234,7 +234,10 @@ func (d *DockerTestFramework) AwaitTransactionState(ctx context.Context, txID io if expectedState == resp.TransactionState { return nil } else { - return ierrors.Errorf("expected transaction %s to have state %s, got %s instead", txID, expectedState, resp.TransactionState) + if resp.TransactionState == api.TransactionStateFailed { + return ierrors.Errorf("expected transaction %s to have state '%s', got '%s' instead, failure reason: %s, failure details: %s", txID, expectedState, resp.TransactionState, resp.TransactionFailureReason, resp.TransactionFailureDetails) + } + return ierrors.Errorf("expected transaction %s to have state '%s', got '%s' instead", txID, expectedState, resp.TransactionState) } }) } @@ -249,7 +252,7 @@ func (d *DockerTestFramework) AwaitTransactionFailure(ctx context.Context, txID if expectedReason == resp.TransactionFailureReason { return nil } else { - return ierrors.Errorf("expected transaction %s to have failure reason %T, got %s instead, failure details: %s", txID, expectedReason, resp.TransactionState, resp.TransactionFailureDetails) + return ierrors.Errorf("expected transaction %s to have failure reason '%s', got '%s' instead, failure details: %s", txID, expectedReason, resp.TransactionFailureReason, resp.TransactionFailureDetails) } }) } diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index 2cb447865..125f00667 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -74,7 +74,7 @@ require ( github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240425100742-5c85b6d16701 // indirect github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240425100432-05e1bf8fc089 // indirect github.com/iotaledger/iota-crypto-demo v0.0.0-20240419094816-40260bb800f7 // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20240425100055-540c74851d65 // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20240503105040-c86882e71808 // indirect github.com/ipfs/boxo v0.19.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index 966ed7410..623804d16 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -331,8 +331,8 @@ github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240425100432-05e1bf8fc089 h1:+NRPSb github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240425100432-05e1bf8fc089/go.mod h1:+iSOmdi7LSd1pXMThZsQk4YDbCSlvVomJUqbRhp3+Nk= github.com/iotaledger/iota-crypto-demo v0.0.0-20240419094816-40260bb800f7 h1:R7ogCKTQ2D5SfVoE6n9GQUsKwm4dcxqwnU863JVlVbw= github.com/iotaledger/iota-crypto-demo v0.0.0-20240419094816-40260bb800f7/go.mod h1:ntqq5J5Fu2SijiqPsjjdFkMm96UhGU/K0z3j6ARpHec= -github.com/iotaledger/iota.go/v4 v4.0.0-20240425100055-540c74851d65 h1:cKn39WbYZrBbGIeK5SZyu1Eukh1IOq8ZdBh7jC2/9Gg= -github.com/iotaledger/iota.go/v4 v4.0.0-20240425100055-540c74851d65/go.mod h1:2/gBFmGlXzZLcpOqTQTl2GqXtoe/aec6Fu9QTooQPZQ= +github.com/iotaledger/iota.go/v4 v4.0.0-20240503105040-c86882e71808 h1:ruI9Xk8g4xbCFsXBBvIXkOi03WprGJyHkmERGSizFTk= +github.com/iotaledger/iota.go/v4 v4.0.0-20240503105040-c86882e71808/go.mod h1:2/gBFmGlXzZLcpOqTQTl2GqXtoe/aec6Fu9QTooQPZQ= github.com/ipfs/boxo v0.19.0 h1:UbX9FBJQF19ACLqRZOgdEla6jR/sC4H1O+iGE0NToXA= github.com/ipfs/boxo v0.19.0/go.mod h1:V5gJzbIMwKEXrg3IdvAxIdF7UPgU4RsXmNGS8MQ/0D4= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=