summaryrefslogtreecommitdiff
path: root/bin/run_tests
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-12-27 16:47:57 -0800
committerelijah <elijah@riseup.net>2013-12-27 16:47:57 -0800
commit71f2d1b0b7db6bb35dd6bd9220795aed3174d90b (patch)
treebde7aab81c42141f0f77897349224c74d4b7af51 /bin/run_tests
parentd86e34564cda2d28fd42d10e584184af7e8b7553 (diff)
added more network tests and pgrep test helper
Diffstat (limited to 'bin/run_tests')
-rwxr-xr-xbin/run_tests19
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/run_tests b/bin/run_tests
index 86a72f26..f4778988 100755
--- a/bin/run_tests
+++ b/bin/run_tests
@@ -107,7 +107,7 @@ class LeapTest < MiniTest::Unit::TestCase
options ||= {}
get(url, params) do |body, response, error|
if body
- yield body
+ yield body if block_given?
elsif response
fail ["Expected a 200 status code from #{url}, but got #{response.code} instead.", options[:error_msg]].compact.join("\n")
else
@@ -231,6 +231,22 @@ class LeapTest < MiniTest::Unit::TestCase
return latest
end
+ #
+ # works like pgrep command line
+ # return an array of hashes like so [{:pid => "1234", :process => "ls"}]
+ #
+ def pgrep(match)
+ output = `pgrep --full --list-name '#{match}'`
+ output.each_line.map{|line|
+ pid = line.split(' ')[0]
+ process = line.gsub(/(#{pid} |\n)/, '')
+ if process =~ /pgrep --full --list-name/
+ nil
+ else
+ {:pid => pid, :process => process}
+ end
+ }.compact
+ end
end
#
@@ -310,6 +326,7 @@ class LeapRunner < MiniTest::Unit
#
def report_line(prefix, klass, meth, e=nil, message=nil)
if message
+ message = message.sub(/http:\/\/([a-z_]+):([a-zA-Z0-9_]+)@/, "http://\\1:password@")
indent = "\n "
msg_txt = indent + message.split("\n").join(indent)
end