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

v2.x -Skip sporadic Zlib::BufError failures in JRuby tests #734

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,22 @@
RubySaml::Logging.logger = TEST_LOGGER

class Minitest::Test
def jruby?
def self.jruby?
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
end

def truffleruby?
def jruby?
self.class.jruby?
end

def self.truffleruby?
defined?(RUBY_ENGINE) && RUBY_ENGINE == 'truffleruby'
end

def truffleruby?
self.class.truffleruby?
end

def fixture(document, base64 = true)
response = Dir.glob(File.join(File.dirname(__FILE__), "responses", "#{document}*")).first
if base64 && response =~ /\.xml$/
Expand Down Expand Up @@ -488,3 +496,19 @@ def encrypt_xml(assertion_xml, private_key)
encrypted_assertion_xml
end
end

# Remove after https://github.com/jruby/jruby/issues/6613 is fixed
if Minitest::Test.jruby?
module JRubyZlibTestExtension
@@jruby_zlib_failures = 0

def run
super
rescue Zlib::BufError => e
raise e unless (@@jruby_zlib_failures += 1) < 10
skip "Skipping Zlib::BufError in JRuby, see https://github.com/jruby/jruby/issues/6613"
end
end

Minitest::Test.prepend(JRubyZlibTestExtension)
end
Loading