Skip to content

1.x: Fix SyncOnSubscribeTest.testConcurrentRequests non-determinism #3536

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

Merged
merged 1 commit into from
Nov 25, 2015

Conversation

akarnokd
Copy link
Member

The test checks if onUnSubscribe is called but that happens after
onCompleted is sent and as such, may run concurrently with the main
thread where the mock is verified. The change switches to CountDownLatch
to properly await the call to onUnsubscribe.

The test checks if onUnSubscribe is called but that happens after
onCompleted is sent and as such, may run concurrently with the main
thread where the mock is verified. The change switches to CountDownLatch
to properly await the call to onUnsubscribe.
@akarnokd akarnokd added this to the 1.0.x milestone Nov 22, 2015
@@ -532,7 +538,10 @@ public Integer call(Integer state, Observer<? super Integer> observer) {
inOrder.verify(o, times(finalCount)).onNext(any());
inOrder.verify(o, times(1)).onCompleted();
inOrder.verifyNoMoreInteractions();
verify(onUnSubscribe, times(1)).call(any(Integer.class));

if (!l3.await(2, TimeUnit.SECONDS)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static import for SECONDS will make code little nicer!

@artem-zinnatullin
Copy link
Contributor

👍

1 similar comment
@stealthcode
Copy link

👍

akarnokd added a commit that referenced this pull request Nov 25, 2015
1.x: Fix SyncOnSubscribeTest.testConcurrentRequests non-determinism
@akarnokd akarnokd merged commit 16e55c3 into ReactiveX:1.x Nov 25, 2015
@akarnokd akarnokd deleted the SyncOnSubscribeTestFix branch November 25, 2015 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants