Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notary: fix "Condition never satisfied" in Notary test, fix #2422 #3337

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions pkg/services/notary/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func TestNotary(t *testing.T) {
defer mtx.RUnlock()
completedTx = completedTxes[h]
return completedTx != nil
}, time.Second*3, time.Millisecond*50, errors.New("main transaction expected to be completed"))
}, time.Second*3, time.Millisecond*50, errors.New("transaction expected to be completed"))
return completedTx
}

Expand Down Expand Up @@ -600,22 +600,14 @@ func TestNotary(t *testing.T) {
// Add block before allowing tx to finalize to exclude race condition when
// main transaction is finalized between `finalizeWithError` restore and adding new block.
e.AddNewBlock(t)
mtx.RLock()
start := len(completedTxes)
mtx.RUnlock()
setFinalizeWithError(false)
for i := range requests {
if i != 0 {
e.AddNewBlock(t)
}
require.Eventually(t, func() bool {
mtx.RLock()
defer mtx.RUnlock()
return len(completedTxes)-start >= i+1
}, time.Second*3, time.Millisecond)
for i := range requests[1:] {
e.AddNewBlock(t)

_ = getCompletedTx(t, true, requests[i+1].FallbackTransaction.Hash())
AnnaShaleva marked this conversation as resolved.
Show resolved Hide resolved
checkMainTx(t, requesters, requests, len(requests), false)
checkFallbackTxs(t, requests[:i+1], true)
checkFallbackTxs(t, requests[i+1:], false)
checkFallbackTxs(t, requests[:i+2], true)
checkFallbackTxs(t, requests[i+2:], false)
}

// OnRequestRemoval: missing account
Expand Down
Loading