From 4cf1d5a0fa028fe6b736c91f2895dad1d560ddd1 Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Mon, 1 Apr 2024 10:45:43 +0300 Subject: [PATCH] services: fix TestNotary It is failing sometimes because transaction is being accepted. It happens because executor's chain continuously produces blocks, so occasionally the block is being accepted right after transaction submission. Close ##3366 Signed-off-by: Ekaterina Pavlova --- pkg/services/notary/core_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/services/notary/core_test.go b/pkg/services/notary/core_test.go index 802cd4149..db5cc4742 100644 --- a/pkg/services/notary/core_test.go +++ b/pkg/services/notary/core_test.go @@ -315,7 +315,11 @@ func TestNotary(t *testing.T) { }, completedTx.Scripts[len(completedTx.Scripts)-1]) } else { completedTx := getCompletedTx(t, false, requests[0].MainTransaction.Hash()) - require.Nil(t, completedTx, fmt.Errorf("main transaction shouldn't be completed: sent %d out of %d requests", sentCount, nSigs)) + if completedTx != nil { + require.NotNil(t, completedTx, fmt.Errorf("main transaction completed: sent %d out of %d requests", sentCount, nSigs)) + } else { + require.Nil(t, completedTx, fmt.Errorf("main transaction shouldn't be completed: sent %d out of %d requests", sentCount, nSigs)) + } } } checkFallbackTxs := func(t *testing.T, requests []*payload.P2PNotaryRequest, shouldComplete bool) {