Merge pull request #3369 from nspcc-dev/test-await
cli: fix TestAwaitUtilCancelTx failing
This commit is contained in:
commit
900ef462df
1 changed files with 18 additions and 6 deletions
|
@ -3,6 +3,7 @@ package util_test
|
|||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -169,11 +170,22 @@ func TestAwaitUtilCancelTx(t *testing.T) {
|
|||
|
||||
e.In.WriteString("one\r")
|
||||
e.Run(t, append(args, txHash.StringLE())...)
|
||||
e.CheckNextLine(t, "Conflicting transaction accepted")
|
||||
resHash, _ := e.CheckAwaitableTxPersisted(t)
|
||||
|
||||
require.Eventually(t, func() bool {
|
||||
_, aerErr := e.Chain.GetAppExecResults(resHash.Hash(), trigger.Application)
|
||||
return aerErr == nil
|
||||
}, time.Second*2, time.Millisecond*50)
|
||||
response := e.GetNextLine(t)
|
||||
if strings.Contains(response, "Conflicting transaction accepted") {
|
||||
resHash, _ := e.CheckAwaitableTxPersisted(t)
|
||||
require.Eventually(t, func() bool {
|
||||
_, aerErr := e.Chain.GetAppExecResults(resHash.Hash(), trigger.Application)
|
||||
return aerErr == nil
|
||||
}, time.Second*2, time.Millisecond*50)
|
||||
} else if strings.Contains(response, "Target transaction accepted") {
|
||||
require.Eventually(t, func() bool {
|
||||
_, _, err := e.Chain.GetTransaction(txHash)
|
||||
require.NoError(t, err, "original transaction should be on chain")
|
||||
_, aerErr := e.Chain.GetAppExecResults(txHash, trigger.Application)
|
||||
return aerErr == nil
|
||||
}, time.Second*2, time.Millisecond*50)
|
||||
} else {
|
||||
t.Fatalf("unexpected response: %s", response)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue