summaryrefslogtreecommitdiff
path: root/test/support/functional_test.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/functional_test.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/functional_test.rb')
-rw-r--r--test/support/functional_test.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/support/functional_test.rb b/test/support/functional_test.rb
new file mode 100644
index 0000000..4ebc40a
--- /dev/null
+++ b/test/support/functional_test.rb
@@ -0,0 +1,41 @@
+require 'minitest/autorun'
+require 'minitest/pride'
+
+class FunctionalTest < Minitest::Test
+
+ protected
+
+ def nickserver_pid
+ status = nickserver "status"
+ /process id (\d*)\./.match(status)[1]
+ end
+
+ def assert_running
+ status = nickserver "status"
+ assert_includes status, "Nickserver running"
+ end
+
+ def assert_stopped
+ status = nickserver "status"
+ assert_includes status, "No nickserver processes are running."
+ end
+
+ def assert_command_runs(command)
+ out = nickserver command
+ assert ($?.exitstatus == 0),
+ "failed to run 'nickserver #{command}':\n #{out}"
+ end
+
+ def nickserver(command)
+ self.class.nickserver command
+ end
+
+ def self.nickserver(command)
+ `#{path_to_executable} #{command} 2>&1`
+ end
+
+ def self.path_to_executable
+ File.expand_path(File.dirname(__FILE__) + '/../../bin/nickserver')
+ end
+
+end