-
Notifications
You must be signed in to change notification settings - Fork 212
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
Bugfix: replace countdown latches with awaitility #1506
Bugfix: replace countdown latches with awaitility #1506
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1506 +/- ##
=======================================
Coverage 67.32% 67.32%
=======================================
Files 725 725
Lines 16120 16120
Branches 1054 1054
=======================================
Hits 10853 10853
Misses 4785 4785
Partials 482 482 Continue to review full report at Codecov.
|
.../org/eclipse/dataspaceconnector/contract/negotiation/ContractNegotiationIntegrationTest.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/dataspaceconnector/contract/negotiation/ContractNegotiationIntegrationTest.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/dataspaceconnector/contract/negotiation/ContractNegotiationIntegrationTest.java
Outdated
Show resolved
Hide resolved
.../org/eclipse/dataspaceconnector/contract/negotiation/ContractNegotiationIntegrationTest.java
Outdated
Show resolved
Hide resolved
var providerNegotiation = providerStore.findForCorrelationId(consumerNegotiationId); | ||
|
||
// Assert that provider and consumer have the same offers stored | ||
assertThat(consumerNegotiation).isNotNull(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems much duplicate code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i extracted a method that performs some basic assertions, but I'm not sure whether that makes the code more or less readable.
ce4c660
to
cb41670
Compare
What this PR changes/adds
Fixes a race condition in the
ContractNegotiationIntegrationTest
by replacing theCountdownLatch
withawaitility
.Awaitility allows for better control over timed assertions than a latch - here it allows us to assert multiple things, in particular:
pre*
method has been calledThe latch only waited for the first condition, whereas Awaitility waits for all of them.
Why it does that
To avoid race conditions, causing sporadically failing tests.
Further notes
ContractNegotiationIntegrationTest
@Disabled
tests (why are they disabled?)Linked Issue(s)
Closes #1505
Checklist
no-changelog
)