summaryrefslogtreecommitdiff
path: root/test/support/http_adapter_helper.rb
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2017-07-21 08:19:20 +0200
committerAzul <azul@riseup.net>2017-07-21 08:53:41 +0200
commit406234367544a4207141230683dddaccd98fb21a (patch)
tree2707fe4563d6be32cd6a9b2d1cb4c1f5f303273c /test/support/http_adapter_helper.rb
parent38dd81116b85c103dbc5e9f08a8ffce26238921a (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/support/http_adapter_helper.rb')
-rw-r--r--test/support/http_adapter_helper.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/support/http_adapter_helper.rb b/test/support/http_adapter_helper.rb
new file mode 100644
index 0000000..6817e1e
--- /dev/null
+++ b/test/support/http_adapter_helper.rb
@@ -0,0 +1,19 @@
+require 'nickserver/adapters/celluloid_http'
+
+module HttpAdapterHelper
+
+ def setup
+ super
+ @adapter = Nickserver::Adapters::CelluloidHttp.new
+ end
+
+ def teardown
+ @adapter.terminate
+ super
+ end
+
+ protected
+
+ attr_reader :adapter
+
+end