-
Notifications
You must be signed in to change notification settings - Fork 916
[PR for discussion] Showing Reactive Streams TCK, proposing some #407
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
Conversation
// FIXME: onSubscribe is user code, and could be ill behaved, as library we should protect from this, | ||
// FIXME: This is covered by spec rule 2.13; proposal: | ||
// As per 2.13, this method must return normally (i.e. not throw). | ||
// try { |
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.
guards such as this are required by the spec, they're not hard to add. The TCK will fail and show which rule has been broken in the existing implemenations pointing these out.
@@ -82,6 +82,7 @@ public ResponseT complete() { | |||
/** | |||
* {@link Subscriber} implementation that writes chunks to a file. | |||
*/ | |||
// FIXME cover with Reactive Streams TCK, looks ok from a first brief look, but could be missing some edge cases |
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.
This PR is not (at least yet), intended to be merged, please assume those are just markers for myself to know where/how many implementations are there and what we should cover with tests.
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.
Added some comments in-line.
Mostly awaiting info if you want to give it a shot to fix the spec violations on your own using the TCK or would ask for some more help with it.
Thanks in advance!
@@ -72,7 +72,7 @@ static String userAgent() { | |||
|
|||
ua = ua | |||
.replace("{platform}", "java") | |||
.replace("{version}", VersionInfo.SDK_VERSION) | |||
.replace("{version}", "MOCK")//VersionInfo.SDK_VERSION) |
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.
FIXME: had a compile error here, remove in case we'd intend to merge this PR
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.
If you run a mvn generate-sources -pl :core
it should generate the VersionInfo
class for you and add it to the generated-sources directory.
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!
public Publisher<ByteBuffer> createFailedPublisher() { | ||
return AsyncRequestProvider.fromFile(fileDoesNotExist.toPath()); | ||
} | ||
} |
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.
simple usage of the TCK. If you want me to submit a complete PR for these things, I'd suggest we use JimFS here, so we can avoid real IO in the testsuite. Would it be ok to include it in the test dependencies? https://github.com/google/jimfs
We're using jimfs for testing such Publishers etc in Akka and it's been pretty reliable.
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.
Shouldn't have any problems using this from a licensing perspective (it's Apache 2.0) - and I'd be OK adding as long as it's only in the test scope.
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.
Excellent, thanks for confirming
@ktoso I like the idea of including tests that validate that we are in compliance with the reactive spec. When you say slow - what are we talking about here? ideally unit tests would be fast and not perform I/O - if this is the case I'd say they could run as part of the regular |
<dependency> | ||
<groupId>org.reactivestreams</groupId> | ||
<artifactId>reactive-streams</artifactId> | ||
<version>${reactive-streams.version}</version> |
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.
It's interesting that you had to explicitly pull this in - was this required or was it just a best practise thing?
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.
Mostly just since I wanted to be on 1.0.2 and I think the Netty adapter library is on previous version. I will double check. It is backwards compatible, so we can use a newer version here (both semantically and binary)
@@ -72,7 +72,7 @@ static String userAgent() { | |||
|
|||
ua = ua | |||
.replace("{platform}", "java") | |||
.replace("{version}", VersionInfo.SDK_VERSION) | |||
.replace("{version}", "MOCK")//VersionInfo.SDK_VERSION) |
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.
If you run a mvn generate-sources -pl :core
it should generate the VersionInfo
class for you and add it to the generated-sources directory.
Got a long inter continental flight coming up now so I’ll work on this a bit more in flight I think. |
I'd say "tens of seconds". We can avoid real IO thanks to Jimfs, so I'll do that and see how long things take. Will move them to |
Worked a bit on this during my flight; not complete yet, more cleanups/fixes to follow. |
@ktoso LGTM! Thank you for helping us get started with this! Happy to merge this in! If you would, could you update you rebase your branch against the latest tip of |
Closing this since the work here was incorporated into #519. |
…f0fc7276 Pull request: release <- staging/4bbfb7ac-0e2a-494d-bf52-2876f0fc7276
The purpose of this PR is to show how to start using the reactive-streams tck (documented here: https://github.com/reactive-streams/reactive-streams-jvm/tree/master/tck ) to validate existing RS implementations in this library. Reactive streams implementations must pass the TCK in order to ensure good inter-op between all libraries.
This PR will fail, as not all implementations are currently compliant.
I can help making them compliant, but wanted to reach first with this preview PR to ask if you'd like to separate our the TCK tests into a separate project, or if you're ok keeping them side by side the other ones like this? They are a bit slow sometimes, as they test many runs, and also await for "things did not happen" etc.
Running the tests will show which specification rules have been violated which should help getting the library compliant pretty quickly, esp as the implementations I've seen are pretty simple so far.
Let me know if you'd want more assistance making all the implementations valid, or if you'd like to take the TCK for a spin yourself first -- I've seen you're aware of the specification requirements in some TODO/FIXME's, so perhaps this is something you've not yet gotten to yet?
Hope this helps, let me know what would be the best way to help you out here.
Refs #406 and #405