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

jruby tests are failing for logstash for encoding UTF-8 #3852

Closed
meghalidhoble opened this issue May 5, 2016 · 8 comments
Closed

jruby tests are failing for logstash for encoding UTF-8 #3852

meghalidhoble opened this issue May 5, 2016 · 8 comments

Comments

@meghalidhoble
Copy link

Jruby Version : jruby 1.7.25
OS : Rhel7.2

I am trying to run tests for logstash code which is written in jruby. The tests are run using the command

rake test:core

The error I am seeing is something like below:

 Failure/Error: expect(subject.sprintf("%{message}").encoding).to eq(Encoding::UTF_8)

       expected: #<Encoding:UTF-8>
            got: #<Encoding:US-ASCII>

       (compared using ==)
       Diff:
       @@ -1,2 +1,2 @@
       -#<Encoding:UTF-8>
       +#<Encoding:US-ASCII>

Does jruby handles encoding in different way? Is there anything that I am missing out here?
Any pointers would really help.
Thanks.

@enebo enebo added this to the JRuby 1.7.26 milestone May 5, 2016
@headius
Copy link
Member

headius commented May 9, 2016

JRuby 1.7 is not as complete in the encoding department as JRuby 9k. Can you narrow this down to a specific test or one-liner?

@meghalidhoble
Copy link
Author

Hi @headius ,
Thanks for the response. I will try to test it with Jruby 9.0.0 version as suggested.
The test-case which is failing for me is as below (copying the code snippet):

 context "#encoding" do
        it "should return known patterns as UTF-8" do
          expect(subject.sprintf("%{message}").encoding).to eq(Encoding::UTF_8)
        end

        it "should return unknown patterns as UTF-8" do
          expect(subject.sprintf("%{unkown_pattern}").encoding).to eq(Encoding::UTF_8)
        end
      end

Its failing at the method call ".encoding".
You can also refer the complete file from github at link : https://github.com/elastic/logstash/blob/master/logstash-core-event/spec/logstash/event_spec.rb

Thanks,
Meghali

@headius
Copy link
Member

headius commented May 10, 2016

Ok, a few more pieces of info and I should be able to replicate this.

  1. What's the encoding of subject when those specs run?
  2. What's the encoding of message and unknown_pattern?
  3. What's the encoding of the "#{message}" and "#{unknown_pattern}" format strings?

@meghalidhoble
Copy link
Author

Hi @headius,
Today I was trying to run the tests with jruby version 9.1.0.0; and here I could not reproduce the above issue; now I am getting different problem the command "rake test" is failing with weird error for rake gem.

[logstash]# bundle exec rake test
Could not find rake-11.1.2 in any of the sources
Run `bundle install` to install missing gems.
[logstash]#
[logstash]# rake test
Could not find rake-11.1.2 in any of the sources
Run `bundle install` to install missing gems.
[ logstash]#
[logstash]# bundle list |grep rake
  * rake (11.1.2)
[logstash]#

I will try to reproduce and let you know the above mentioned details soon.
Thanks for looking into this.

@mkristian
Copy link
Member

@meghalidhoble which version of bundler ? latest ?

@headius
Copy link
Member

headius commented May 11, 2016

@meghalidhoble So do you mean the issue appears to be fixed in 9.1, or do you mean you were unable to confirm it because of the rake issue?

@meghalidhoble
Copy link
Author

Hi @headius , that's right I couldn't confirm due to the rake issue.
Today when I tried my build with Jruby 1.7.25 (older version) and installed it using RVM it worked fine for me and I am not getting the issue any more now. Please note that Jruby version 9.1.0.0 was giving me different issues.
I will keep watching the build for consistency. Thanks for all your help.
-Meghali

@headius
Copy link
Member

headius commented May 12, 2016

Ok, I will close this and file a separate issue for the rake problem. I suspect it is the same as #3850 and #3867.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants