diff options
author | Azul <azul@riseup.net> | 2017-07-21 08:19:20 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2017-07-21 08:53:41 +0200 |
commit | 406234367544a4207141230683dddaccd98fb21a (patch) | |
tree | 2707fe4563d6be32cd6a9b2d1cb4c1f5f303273c /test/remote/hkp_source_test.rb | |
parent | 38dd81116b85c103dbc5e9f08a8ffce26238921a (diff) |
fix: filedescriptor leak from http_adapters
Now we reuse a single adapter for all requests triggered
by an incoming request. Then we .terminate the adapter.
Includes a regression test.
Diffstat (limited to 'test/remote/hkp_source_test.rb')
-rw-r--r-- | test/remote/hkp_source_test.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/remote/hkp_source_test.rb b/test/remote/hkp_source_test.rb index 103b8ad..ff61513 100644 --- a/test/remote/hkp_source_test.rb +++ b/test/remote/hkp_source_test.rb @@ -1,8 +1,10 @@ require 'test_helper' require 'support/celluloid_test' +require 'support/http_adapter_helper' require 'nickserver/hkp/source' class RemoteHkpSourceTest < CelluloidTest + include HttpAdapterHelper def test_key_info uid = 'elijah@riseup.net' @@ -31,12 +33,17 @@ class RemoteHkpSourceTest < CelluloidTest protected - def assert_key_info_for_uid(uid, &block) - Nickserver::Hkp::Source.new.search uid do |status, keys| + def assert_key_info_for_uid(uid) + source.search uid do |status, keys| assert_equal 200, status yield keys end rescue HTTP::ConnectionError => e skip "could not talk to hkp server: #{e}" end + + def source + Nickserver::Hkp::Source.new adapter + end + end |