-
Notifications
You must be signed in to change notification settings - Fork 534
Ensure TCK passes with empty publisher that synchronously completes #423
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
Ensure TCK passes with empty publisher that synchronously completes #423
Conversation
@@ -599,6 +602,7 @@ public void onSubscribe(Subscription s) { | |||
env.debug(String.format("%s::onSubscribe(%s)", this, s)); | |||
if (!subscription.isCompleted()) { | |||
subscription.complete(s); |
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.
There is a completeImmediately() method on the promise.
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.
Btw. the plain complete()
behavior is odd. I'd think once called, isCompleted()
should report true but the implementation queues the object.
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 agree - but I'm not familiar enough with the TCK to change it. Though I can understand why the event is queued, so that the order of events can be verified and duplicates can be detected etc.
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'll investigate this
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.
Thanks for noticing, I think we can improve the impl there. I'll work on it today after done with work stuff.
I'll PR into this PR then :)
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 reimplemented the Promise which makes this workwithout the additional atomic.
Please see here: jroper#1
Thanks @jroper! @Override
public void onNext(T element) {
env.debug(String.format("%s::onNext(%s)", this, element));
if (subscription.isCompleted()) { // Shouldn't this be onSubscribeCalled.get() too? (for subscribe + onSubscribe + sync request(n) + onNext?
super.onNext(element);
} else {
env.flop(String.format("Subscriber::onNext(%s) called before Subscriber::onSubscribe", element));
}
} |
I thought about changing |
} catch (SkipException skip) { | ||
throw new RuntimeException("Expected TCK to PASS this test, instead it was SKIPPED", skip.getCause()); | ||
} catch (Throwable throwable) { | ||
throw new RuntimeException( |
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.
Repackage Errors as Exceptions?
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.
Just being consistent with requireTestFailure
and requireTestSkip
.
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.
Does not really matter much as those will end up failing the test in the suite and one may always look into the logs. It's not like it's a production app where we have to watch out to not accidentally continue after an OOM or something... Fine as is I think
Improve Promise impl to make the test valid without adding onSubscribeCalled
PR was merged, thanks @jroper ! Seems good to go from my side then |
thanks @jroper! |
Fixes #422