diff options
author | Eric Wong <e@80x24.org> | 2017-01-26 21:42:54 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-01-26 21:42:54 +0000 |
commit | d080b456e129e2ebffdcdbfb601895b4c93dc1e4 (patch) | |
tree | 2fb09091fbb60717cb97f13940bc261501d0d218 /test/test_nhp_compat.rb | |
parent | d32775bded58382bcfb9196829eb356eed267e08 (diff) | |
download | mogilefs-client-d080b456e129e2ebffdcdbfb601895b4c93dc1e4.tar.gz |
The optional net-http-persistent RubyGem we use has a major incompatible change from the 2.x versions. Support them both.
Diffstat (limited to 'test/test_nhp_compat.rb')
-rw-r--r-- | test/test_nhp_compat.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_nhp_compat.rb b/test/test_nhp_compat.rb new file mode 100644 index 0000000..282dcf5 --- /dev/null +++ b/test/test_nhp_compat.rb @@ -0,0 +1,25 @@ +require 'test/unit' + +class TestNhpCompat < Test::Unit::TestCase + + def test_nhp_compat + ver_test_nhp('~> 2.9') + ver_test_nhp('~> 3.0') + end + + def ver_test_nhp(verspec) + pid = fork do + begin + gem 'net-http-persistent', verspec + rescue LoadError => e + warn "SKIPPING net-http-persistent #{verspec}\n" \ + "#{e.message} (#{e.class})\n" + end + require 'mogilefs' + mg = MogileFS::MogileFS.new :hosts => %w(127.0.0.1:7500), :domain => 'x' + exit!(Net::HTTP::Persistent === mg.nhp_new('foo')) + end + _, status = Process.waitpid2(pid) + assert status.success?, status.inspect + end +end |