From c20aa4f8c35a4cba982de92105da2566ecdfa1ae Mon Sep 17 00:00:00 2001 From: elijah Date: Sun, 22 Jun 2014 13:42:04 -0700 Subject: run_tests: allow for https in assert_get() --- bin/run_tests | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/run_tests b/bin/run_tests index 526aa83a..3ba89684 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -127,11 +127,18 @@ class LeapTest < MiniTest::Unit::TestCase if params uri.query = URI.encode_www_form(params) end - response = Net::HTTP.get_response(uri) - if response.is_a?(Net::HTTPSuccess) - yield response.body, response, nil - else - yield nil, response, nil + http = Net::HTTP.new uri.host, uri.port + if uri.scheme == 'https' + http.verify_mode = OpenSSL::SSL::VERIFY_NONE + http.use_ssl = true + end + http.start do |agent| + response = agent.get(uri.request_uri) + if response.is_a?(Net::HTTPSuccess) + yield response.body, response, nil + else + yield nil, response, nil + end end rescue => exc yield nil, nil, exc -- cgit v1.2.3 From 10c76ac1cfa4e94375b456266e4113a4313abe96 Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 23 Jun 2014 02:40:21 -0700 Subject: tests: fixed problem with showing couchdb password in process table, and adding warnings for when ACL is not being respected (which is currently always). closes #5445 --- bin/run_tests | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/run_tests b/bin/run_tests index 3ba89684..d7fc1e4c 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -122,7 +122,7 @@ class LeapTest < MiniTest::Unit::TestCase # # attempts a http GET on the url, yields |body, response, error| # - def get(url, params=nil) + def get(url, params=nil, options=nil) uri = URI(url) if params uri.query = URI.encode_www_form(params) @@ -133,7 +133,11 @@ class LeapTest < MiniTest::Unit::TestCase http.use_ssl = true end http.start do |agent| - response = agent.get(uri.request_uri) + request = Net::HTTP::Get.new uri.request_uri + if options && options[:username] + request.basic_auth options[:username], options[:password] + end + response = agent.request(request) if response.is_a?(Net::HTTPSuccess) yield response.body, response, nil else @@ -146,7 +150,7 @@ class LeapTest < MiniTest::Unit::TestCase def assert_get(url, params=nil, options=nil) options ||= {} - get(url, params) do |body, response, error| + get(url, params, options) do |body, response, error| if body yield body if block_given? elsif response @@ -157,6 +161,19 @@ class LeapTest < MiniTest::Unit::TestCase end end + # + # only a warning for now, should be a failure in the future + # + def assert_auth_fail(url, params, auth_options) + get(url, params, auth_options) do |body, response, error| + unless response.code == 401 + warn "Expected a '401 Unauthorized' response, but got #{response.code} instead (GET #{url} with username '#{auth_options[:username]}')." + return false + end + end + true + end + # # test if a socket can be connected to # -- cgit v1.2.3 From edf1306a418203df297d034544d51f5cdcd053c7 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 25 Jun 2014 17:21:49 -0700 Subject: run_tests: clean up assert_get() --- bin/run_tests | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/run_tests b/bin/run_tests index d7fc1e4c..2ee027f4 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -122,7 +122,7 @@ class LeapTest < MiniTest::Unit::TestCase # # attempts a http GET on the url, yields |body, response, error| # - def get(url, params=nil, options=nil) + def get(url, params=nil) uri = URI(url) if params uri.query = URI.encode_www_form(params) @@ -134,8 +134,8 @@ class LeapTest < MiniTest::Unit::TestCase end http.start do |agent| request = Net::HTTP::Get.new uri.request_uri - if options && options[:username] - request.basic_auth options[:username], options[:password] + if uri.user + request.basic_auth uri.user, uri.password end response = agent.request(request) if response.is_a?(Net::HTTPSuccess) @@ -150,7 +150,7 @@ class LeapTest < MiniTest::Unit::TestCase def assert_get(url, params=nil, options=nil) options ||= {} - get(url, params, options) do |body, response, error| + get(url, params) do |body, response, error| if body yield body if block_given? elsif response @@ -164,10 +164,11 @@ class LeapTest < MiniTest::Unit::TestCase # # only a warning for now, should be a failure in the future # - def assert_auth_fail(url, params, auth_options) - get(url, params, auth_options) do |body, response, error| - unless response.code == 401 - warn "Expected a '401 Unauthorized' response, but got #{response.code} instead (GET #{url} with username '#{auth_options[:username]}')." + def assert_auth_fail(url, params) + uri = URI(url) + get(url, params) do |body, response, error| + unless response.code.to_s == "401" + warn "Expected a '401 Unauthorized' response, but got #{response.code} instead (GET #{uri.request_uri} with username '#{uri.user}')." return false end end -- cgit v1.2.3 From 82dbbf823d6637082f63e55ed1d2f57a11e0d481 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 26 Jun 2014 02:34:08 -0700 Subject: puppet_command: set hostname manually, not via puppet. --- bin/puppet_command | 55 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 21 deletions(-) (limited to 'bin') diff --git a/bin/puppet_command b/bin/puppet_command index a6cd5a69..a9d39066 100755 --- a/bin/puppet_command +++ b/bin/puppet_command @@ -7,12 +7,15 @@ # (exit codes, lockfile, multiple manifests, etc) # +require 'pty' +require 'yaml' + PUPPET_BIN = '/usr/bin/puppet' PUPPET_DIRECTORY = '/srv/leap' PUPPET_PARAMETERS = '--color=false --detailed-exitcodes --libdir=puppet/lib --confdir=puppet' SITE_MANIFEST = 'puppet/manifests/site.pp' -SETUP_MANIFEST = 'puppet/manifests/setup.pp' DEFAULT_TAGS = 'leap_base,leap_service' +HIERA_FILE = '/etc/leap/hiera.yaml' def main process_command_line_arguments @@ -54,21 +57,37 @@ def apply end def set_hostname - exit_code = puppet_apply(:manifest => SETUP_MANIFEST, :tags => '') do |line| - # todo: replace setup.pp with https://github.com/lutter/ruby-augeas - # or try this: http://www.puppetcookbook.com/posts/override-a-facter-fact.html - if (line !~ /Finished catalog run/ || @verbosity > 2) && - (line !~ /dnsdomainname: Name or service not known/) && - (line !~ /warning: Could not retrieve fact fqdn/) - puts line + unless File.exists?(HIERA_FILE) + puts("ERROR: Cannot set hostname without #{HIERA_FILE}") + exit(1) + end + hostname = YAML.load_file(HIERA_FILE)['name'] + if hostname.nil? || hostname.empty? + puts('ERROR: NAME argument required') + exit(1) + end + current_hostname_file = File.read('/etc/hostname') rescue nil + current_hostname = `/bin/hostname`.strip + + # set /etc/hostname + if current_hostname_file != hostname + File.open('/etc/hostname', 'w', 0611, :encoding => 'ascii') do |f| + f.write hostname + end + if File.read('/etc/hostname') == hostname + puts "Set /etc/hostname to #{hostname}" + else + puts "ERROR: failed to update /etc/hostname" end end - if exit_code == 2 - puts "Hostname updated." - elsif exit_code == 4 || exit_code == 6 - puts "ERROR: could not update hostname." - elsif exit_code == 0 && @verbosity > 1 - puts "No change to hostname." + + # call /bin/hostname + if current_hostname != hostname + if run("/bin/hostname #{hostname}") == 0 + puts "Set hostname to #{hostname}" + else + puts "ERROR: failed to call `/bin/hostname #{hostname}`" + end end end @@ -157,24 +176,18 @@ end ## this only works under ruby 1.9 ## -require "pty" - def run(cmd) puts cmd if @verbosity >= 3 PTY.spawn("#{cmd}") do |output, input, pid| begin while line = output.gets do yield line - #$stdout.puts line - #$stdout.flush end rescue Errno::EIO end Process.wait(pid) # only works in ruby 1.9, required to capture the exit status. end - status = $?.exitstatus - #yield status if block_given? - return status + return $?.exitstatus rescue PTY::ChildExited end -- cgit v1.2.3 From 72bad39f8a21c3be33b17134d2e3ca11f5e0d58f Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 2 Sep 2014 22:02:41 -0700 Subject: tests: make warnings not produce a non-zero exit code, add 'ignore' command to tests, make shorewall optional. --- bin/run_tests | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/run_tests b/bin/run_tests index 2ee027f4..e026b5f7 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -41,6 +41,7 @@ end ## # this class is raised if a test file wants to be skipped entirely. +# (to skip an individual test, MiniTest::Skip is used instead) class SkipTest < Exception end @@ -62,6 +63,8 @@ end class LeapTest < MiniTest::Unit::TestCase class Pass < MiniTest::Assertion end + class Ignore < MiniTest::Assertion + end def initialize(name) super(name) @@ -100,6 +103,13 @@ class LeapTest < MiniTest::Unit::TestCase raise LeapTest::Pass end + # + # Called when the test should be silently ignored. + # + def ignore + raise LeapTest::Ignore + end + # # the default fail() is part of the kernel and it just throws a runtime exception. for tests, # we want the same behavior as assert(false) @@ -332,6 +342,7 @@ class LeapRunner < MiniTest::Unit def initialize @passes = 0 @warnings = 0 + @ignores = 0 super end @@ -372,9 +383,12 @@ class LeapRunner < MiniTest::Unit case e when MiniTest::Skip then @skips += 1 - #if @verbose - report_line("SKIP", klass, meth, e, e.message) - #end + report_line("SKIP", klass, meth, e, e.message) + when LeapTest::Ignore then + @ignores += 1 + if @verbose + report_line("IGNORE", klass, meth, e, e.message) + end when LeapTest::Pass then @passes += 1 report_line("PASS", klass, meth) @@ -414,7 +428,8 @@ class LeapRunner < MiniTest::Unit elsif @failures > 0 :failure elsif @warnings > 0 - :warning + # :warning << warnings don't warrant a non-zero exit code. + :success else :success end -- cgit v1.2.3 From 77fe62679399c8a780106a50f579f0194be46e6b Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 15 Sep 2014 16:29:36 -0400 Subject: tests: make warnings not produce a non-zero exit code Change-Id: I60d51728128b95c77d52ab4e8c61966cfa59ff2f --- bin/run_tests | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/run_tests b/bin/run_tests index 2ee027f4..586a8ca1 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -414,7 +414,8 @@ class LeapRunner < MiniTest::Unit elsif @failures > 0 :failure elsif @warnings > 0 - :warning + # :warning << warnings don't warrant a non-zero exit code. + :success else :success end -- cgit v1.2.3 From a3dfbb9b44d0b3cdeaa451adf63ac870ca7fe1d7 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 17 Sep 2014 14:15:22 -0700 Subject: override facter fact for fqdn --- bin/puppet_command | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'bin') diff --git a/bin/puppet_command b/bin/puppet_command index a9d39066..e1752ec2 100755 --- a/bin/puppet_command +++ b/bin/puppet_command @@ -57,13 +57,9 @@ def apply end def set_hostname - unless File.exists?(HIERA_FILE) - puts("ERROR: Cannot set hostname without #{HIERA_FILE}") - exit(1) - end - hostname = YAML.load_file(HIERA_FILE)['name'] + hostname = hiera_file['name'] if hostname.nil? || hostname.empty? - puts('ERROR: NAME argument required') + puts('ERROR: "name" missing from hiera file') exit(1) end current_hostname_file = File.read('/etc/hostname') rescue nil @@ -75,7 +71,7 @@ def set_hostname f.write hostname end if File.read('/etc/hostname') == hostname - puts "Set /etc/hostname to #{hostname}" + puts "Changed /etc/hostname to #{hostname}" else puts "ERROR: failed to update /etc/hostname" end @@ -84,9 +80,9 @@ def set_hostname # call /bin/hostname if current_hostname != hostname if run("/bin/hostname #{hostname}") == 0 - puts "Set hostname to #{hostname}" + puts "Changed hostname to #{hostname}" else - puts "ERROR: failed to call `/bin/hostname #{hostname}`" + puts "ERROR: call to `/bin/hostname #{hostname}` returned an error." end end end @@ -97,9 +93,25 @@ end def puppet_apply(options={}, &block) options = {:verbosity => @verbosity, :tags => @tags}.merge(options) manifest = options[:manifest] || SITE_MANIFEST + fqdn = hiera_file['domain']['name'] Dir.chdir(PUPPET_DIRECTORY) do - return run("#{PUPPET_BIN} apply #{custom_parameters(options)} #{PUPPET_PARAMETERS} #{manifest}", &block) + return run("FACTER_fqdn='#{fqdn}' #{PUPPET_BIN} apply #{custom_parameters(options)} #{PUPPET_PARAMETERS} #{manifest}", &block) + end +end + +# +# Return a ruby object representing the contents of the hiera yaml file. +# +def hiera_file + unless File.exists?(HIERA_FILE) + puts("ERROR: hiera file '#{HIERA_FILE}' does not exist.") + exit(1) end + $hiera_contents ||= YAML.load_file(HIERA_FILE) + return $hiera_contents +rescue Exception => exc + puts("ERROR: problem reading hiera file '#{HIERA_FILE}' (#{exc})") + exit(1) end def custom_parameters(options) -- cgit v1.2.3 From f6ffad33042aa6580ec00ef23836291861c1ae17 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 20 Oct 2014 21:44:37 -0400 Subject: implement custom puppet support (#6201, #6226) change puppet command to include in the --modulepath /srv/leap/files/puppet/modules If a provider places puppet code under files/puppet it will be sync'd over to all the nodes, once leap cli #6225 is merged. The custom puppet entry point is in class 'custom' which can be put into files/puppet/modules/custom/manifests/init.pp Change-Id: I74879c6ee056b03cd4691aa81a7668b60383bdad --- bin/puppet_command | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/puppet_command b/bin/puppet_command index 5e690bef..cdb0b027 100755 --- a/bin/puppet_command +++ b/bin/puppet_command @@ -14,6 +14,8 @@ PUPPET_BIN = '/usr/bin/puppet' PUPPET_DIRECTORY = '/srv/leap' PUPPET_PARAMETERS = '--color=false --detailed-exitcodes --libdir=puppet/lib --confdir=puppet' SITE_MANIFEST = 'puppet/manifests/site.pp' +SITE_MODULES = 'puppet/modules' +CUSTOM_MODULES = ':files/puppet/modules' DEFAULT_TAGS = 'leap_base,leap_service' HIERA_FILE = '/etc/leap/hiera.yaml' @@ -93,10 +95,11 @@ end def puppet_apply(options={}, &block) options = {:verbosity => @verbosity, :tags => @tags}.merge(options) manifest = options[:manifest] || SITE_MANIFEST + modulepath = options[:module_path] || SITE_MODULES + CUSTOM_MODULES fqdn = hiera_file['domain']['name'] domain = hiera_file['domain']['full_suffix'] Dir.chdir(PUPPET_DIRECTORY) do - return run("FACTER_fqdn='#{fqdn}' FACTER_domain='#{domain}' #{PUPPET_BIN} apply #{custom_parameters(options)} #{PUPPET_PARAMETERS} #{manifest}", &block) + return run("FACTER_fqdn='#{fqdn}' FACTER_domain='#{domain}' #{PUPPET_BIN} apply #{custom_parameters(options)} --modulepath='#{modulepath}' #{PUPPET_PARAMETERS} #{manifest}", &block) end end -- cgit v1.2.3 From 9299574b45de02d417e7237ba49b0222002bbc21 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 15 Oct 2014 15:28:54 -0700 Subject: tests - added test that creates user, authenticates, deletes user --- bin/run_tests | 224 +++++----------------------------------------------------- 1 file changed, 19 insertions(+), 205 deletions(-) (limited to 'bin') diff --git a/bin/run_tests b/bin/run_tests index e026b5f7..b3e60fcc 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -14,7 +14,6 @@ require 'minitest/unit' require 'yaml' require 'tsort' -require 'net/http' ## ## EXIT CODES @@ -114,7 +113,10 @@ class LeapTest < MiniTest::Unit::TestCase # the default fail() is part of the kernel and it just throws a runtime exception. for tests, # we want the same behavior as assert(false) # - def fail(msg=nil) + def fail(msg=nil, exception=nil) + if DEBUG && exception && exception.respond_to?(:backtrace) + msg += MiniTest::filter_backtrace(exception.backtrace).join "\n" + end assert(false, msg) end @@ -129,207 +131,6 @@ class LeapTest < MiniTest::Unit::TestCase :alpha end - # - # attempts a http GET on the url, yields |body, response, error| - # - def get(url, params=nil) - uri = URI(url) - if params - uri.query = URI.encode_www_form(params) - end - http = Net::HTTP.new uri.host, uri.port - if uri.scheme == 'https' - http.verify_mode = OpenSSL::SSL::VERIFY_NONE - http.use_ssl = true - end - http.start do |agent| - request = Net::HTTP::Get.new uri.request_uri - if uri.user - request.basic_auth uri.user, uri.password - end - response = agent.request(request) - if response.is_a?(Net::HTTPSuccess) - yield response.body, response, nil - else - yield nil, response, nil - end - end - rescue => exc - yield nil, nil, exc - end - - def assert_get(url, params=nil, options=nil) - options ||= {} - get(url, params) do |body, response, error| - if 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 - fail ["Expected a response from #{url}, but got \"#{error}\" instead.", options[:error_msg]].compact.join("\n") - end - end - end - - # - # only a warning for now, should be a failure in the future - # - def assert_auth_fail(url, params) - uri = URI(url) - get(url, params) do |body, response, error| - unless response.code.to_s == "401" - warn "Expected a '401 Unauthorized' response, but got #{response.code} instead (GET #{uri.request_uri} with username '#{uri.user}')." - return false - end - end - true - end - - # - # test if a socket can be connected to - # - - # - # tcp connection helper with timeout - # - def try_tcp_connect(host, port, timeout = 5) - addr = Socket.getaddrinfo(host, nil) - sockaddr = Socket.pack_sockaddr_in(port, addr[0][3]) - - Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0).tap do |socket| - socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) - begin - socket.connect_nonblock(sockaddr) - rescue IO::WaitReadable - if IO.select([socket], nil, nil, timeout) == nil - raise "Connection timeout" - else - socket.connect_nonblock(sockaddr) - end - rescue IO::WaitWritable - if IO.select(nil, [socket], nil, timeout) == nil - raise "Connection timeout" - else - socket.connect_nonblock(sockaddr) - end - end - return socket - end - end - - def try_tcp_write(socket, timeout = 5) - begin - socket.write_nonblock("\0") - rescue IO::WaitReadable - if IO.select([socket], nil, nil, timeout) == nil - raise "Write timeout" - else - retry - end - rescue IO::WaitWritable - if IO.select(nil, [socket], nil, timeout) == nil - raise "Write timeout" - else - retry - end - end - end - - def try_tcp_read(socket, timeout = 5) - begin - socket.read_nonblock(1) - rescue IO::WaitReadable - if IO.select([socket], nil, nil, timeout) == nil - raise "Read timeout" - else - retry - end - rescue IO::WaitWritable - if IO.select(nil, [socket], nil, timeout) == nil - raise "Read timeout" - else - retry - end - end - end - - def assert_tcp_socket(host, port, msg=nil) - begin - socket = try_tcp_connect(host, port, 1) - #try_tcp_write(socket,1) - #try_tcp_read(socket,1) - rescue StandardError => exc - fail ["Failed to open socket #{host}:#{port}", exc].join("\n") - ensure - socket.close if socket - end - end - - # - # Matches the regexp in the file, and returns the first matched string (or fails if no match). - # - def file_match(filename, regexp) - if match = File.read(filename).match(regexp) - match.captures.first - else - fail "Regexp #{regexp.inspect} not found in file #{filename.inspect}." - end - end - - # - # Matches the regexp in the file, and returns array of matched strings (or fails if no match). - # - def file_matches(filename, regexp) - if match = File.read(filename).match(regexp) - match.captures - else - fail "Regexp #{regexp.inspect} not found in file #{filename.inspect}." - end - end - - # - # checks to make sure the given property path exists in $node (e.g. hiera.yaml) - # and returns the value - # - def assert_property(property) - latest = $node - property.split('.').each do |segment| - latest = latest[segment] - fail "Required node property `#{property}` is missing." if latest.nil? - end - 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 - -def assert_running(process) - assert pgrep(process).any?, "No running process for #{process}" -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 # @@ -441,7 +242,7 @@ class LeapRunner < MiniTest::Unit def report_line(prefix, klass, meth, e=nil, message=nil) msg_txt = nil if message - message = message.sub(/http:\/\/([a-z_]+):([a-zA-Z0-9_]+)@/, "http://\\1:password@") + message = message.sub(/http:\/\/([a-z_]+):([a-zA-Z0-9_]+)@/, "http://\\1:REDACTED@") if $output_format == :human indent = "\n " msg_txt = indent + message.split("\n").join(indent) @@ -556,7 +357,8 @@ def print_help " --test TEST Run only the test with name TEST.", " --list-tests Prints the names of all available tests and exit.", " --retry COUNT If the tests don't pass, retry COUNT additional times (default is zero)", - " --wait SECONDS Wait for SECONDS between retries (default is 5)"].join("\n") + " --wait SECONDS Wait for SECONDS between retries (default is 5)", + " --debug Print out full stack trace on errors"].join("\n") exit(0) end @@ -615,6 +417,9 @@ def main # load all test classes this_file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__ + Dir[File.expand_path('../../tests/helpers/*.rb', this_file)].each do |helper| + require helper + end Dir[File.expand_path('../../tests/white-box/*.rb', this_file)].each do |test_file| begin require test_file @@ -636,10 +441,19 @@ def main when '--list-tests' then list_tests when '--retry' then ARGV.shift; $retry = ARGV.shift.to_i when '--wait' then ARGV.shift; $wait = ARGV.shift.to_i + when '--debug' then ARGV.shift + when '-d' then ARGV.shift else break end end run_tests end +if ARGV.include?('--debug') || ARGV.include?('-d') + DEBUG=true + require 'debugger' +else + DEBUG=false +end + main() -- cgit v1.2.3 From 6200be6fbf1f05665158e9ce8b218433f2440240 Mon Sep 17 00:00:00 2001 From: elijah Date: Wed, 19 Nov 2014 11:37:45 -0800 Subject: test if soledad daemon is running --- bin/run_tests | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bin') diff --git a/bin/run_tests b/bin/run_tests index b3e60fcc..4addc0c8 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -35,6 +35,14 @@ def bail(code, msg=nil) end end +## +## UTILITY +## + +def service?(service) + $node["services"].include?(service.to_s) +end + ## ## EXCEPTIONS ## -- cgit v1.2.3 From 7ca1a6feb2f881f2a99b624c266f0779d2402ff9 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 4 Dec 2014 15:16:25 -0800 Subject: tests - better errors, ensure tmp users are deleted, remove bad 'pass()' call that made tmp_user tests always succeed. --- bin/run_tests | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/run_tests b/bin/run_tests index 4addc0c8..44384379 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -49,15 +49,15 @@ end # this class is raised if a test file wants to be skipped entirely. # (to skip an individual test, MiniTest::Skip is used instead) -class SkipTest < Exception +class SkipTest < StandardError end # raised if --no-continue and there is an error -class TestError < Exception +class TestError < StandardError end # raised if --no-continue and there is a failure -class TestFailure < Exception +class TestFailure < StandardError end ## -- cgit v1.2.3