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

ContractNegotiationIntegrationTest: race condition #1505

Closed
algattik opened this issue Jun 20, 2022 · 1 comment · Fixed by #1506
Closed

ContractNegotiationIntegrationTest: race condition #1505

algattik opened this issue Jun 20, 2022 · 1 comment · Fixed by #1506
Assignees
Labels
bug Something isn't working

Comments

@algattik
Copy link
Contributor

Bug Report

Describe the Bug

Observed in a non-reproducible manner

ContractNegotiationIntegrationTest > testNegotiation_initialOfferAccepted() FAILED
 org.opentest4j.AssertionFailedError:
 expected: null
  but was: org.eclipse.dataspaceconnector.spi.types.domain.contract.agreement.ContractAgreement@e70b6dd7
     at java.base@11.0.15/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at java.base@11.0.15/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
     at java.base@11.0.15/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at app//org.eclipse.dataspaceconnector.contract.negotiation.ContractNegotiationIntegrationTest.testNegotiation_initialOfferAccepted(ContractNegotiationIntegrationTest.java:78

Possible Implementation

Latch waits for the observable to be triggered, then test makes assertion on persisted data.

This is a race condition, since data is persisted after the observable is invoked.

Add post* observable operations?

@algattik algattik added the bug Something isn't working label Jun 20, 2022
@paullatzelsperger
Copy link
Member

paullatzelsperger commented Jun 21, 2022

Not the biggest fan of CountDownLatches, especially when libs like awaitility exist. Let me try and wrap the assertions in await() chains

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants