summaryrefslogtreecommitdiff
path: root/tests/helpers/os_helper.rb
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2016-11-04 10:54:28 -0400
committerMicah Anderson <micah@riseup.net>2016-11-04 10:54:28 -0400
commit34a381efa8f6295080c843f86bfa07d4e41056af (patch)
tree9282cf5d4c876688602705a7fa0002bc4a810bde /tests/helpers/os_helper.rb
parent0a72bc6fd292bf9367b314fcb0347c4d35042f16 (diff)
parent5821964ff7e16ca7aa9141bd09a77d355db492a9 (diff)
Merge branch 'develop'
Diffstat (limited to 'tests/helpers/os_helper.rb')
-rw-r--r--tests/helpers/os_helper.rb41
1 files changed, 0 insertions, 41 deletions
diff --git a/tests/helpers/os_helper.rb b/tests/helpers/os_helper.rb
deleted file mode 100644
index da9ac843..00000000
--- a/tests/helpers/os_helper.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-class LeapTest
-
- #
- # 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)/, '')
- # filter out pgrep cmd itself
- # on wheezy hosts, the "process" var contains the whole cmd including all parameters
- # on jessie hosts, it only contains the first cmd (which is the default sheel invoked by 'sh')
- if process =~ /^sh/
- nil
- else
- {:pid => pid, :process => process}
- end
- }.compact
- end
-
- def assert_running(process, options={})
- processes = pgrep(process)
- assert processes.any?, "No running process for #{process}"
- if options[:single]
- assert processes.length == 1, "More than one process for #{process}"
- end
- end
-
- #
- # runs the specified command, failing on a non-zero exit status.
- #
- def assert_run(command)
- output = `#{command}`
- if $?.exitstatus != 0
- fail "Error running `#{command}`:\n#{output}"
- end
- end
-
-end \ No newline at end of file