JRuby 9k fails cuke tests where the output contain non-English characters #417
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
JRuby 9.0.5.0 fails cuke tests where the output contain non-English characters.
Details
I tracked this down to an encoding error reported in childprocess when pumping data from the invoked command to the stdout tempfile. My fix is to set the stdout and stderr output files to be in binmode, and then the string matchers for the output declare that the actual result (read from the tempfiles as binary data) is actually UTF-8. This causes no harm in old JRuby or MRI afaict; my cuke tests for my application pass with this fix in place just like they passed before.
Motivation and Context
Cuke tests for the DataStax Ruby driver failed against jruby 9k, a platform we are trying to support now.
How Has This Been Tested?
Sorry, don't have aruba tests. :(
The cuke test that failed (there are several that failed the same way, but I focused on this one): https://github.com/datastax/ruby-driver/blob/master/features/asynchronous_io/executing_queries.feature#L45-L62
The error occurred in the "When it is executed" part:
https://datastax-oss.atlassian.net/browse/RUBY-163
Fixing SpawnProcess.start got past this error, but the "Then" clause started failing with an encoding error. I introduced the force_encoding of actual results in relevant functions to fix that.
I did test that my cuke tests pass on MRI 2.3 and JRuby 1.7.x with these changes, so it doesn't seem like I introduced a regression.
Screenshots (if appropriate):
Types of changes
I'm not sure if this will break anyone. Changing those matchers to assume 'actual' is utf-8 might be overzealous.
Checklist: