diff options
author | Micah Anderson <micah@leap.se> | 2015-06-11 12:10:09 -0400 |
---|---|---|
committer | Micah Anderson <micah@leap.se> | 2015-06-11 12:10:09 -0400 |
commit | b429b30bda4dafc78cb02f6ece5d82f08e35de1f (patch) | |
tree | 37efc30a4fcb642dec583c3accea76f7a7de9c39 /bin/run_tests | |
parent | 67b2bea2dfcfb06191bf5ed562309f264c6aed8c (diff) | |
parent | d9146415db0e6b7dd0c945039c0a4ed4fd054a7d (diff) |
Merge tag '0.7.0'
Releasing 0.7.0
Diffstat (limited to 'bin/run_tests')
-rwxr-xr-x | bin/run_tests | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/bin/run_tests b/bin/run_tests index 44384379..8eab5286 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -16,7 +16,7 @@ require 'yaml' require 'tsort' ## -## EXIT CODES +## CONSTANTS ## EXIT_CODES = { @@ -26,6 +26,20 @@ EXIT_CODES = { :error => 3 } +HIERA_FILE = '/etc/leap/hiera.yaml' +HELPER_PATHS = [ + '../../tests/helpers/*.rb', + '/srv/leap/files/tests/helpers/*.rb' +] +TEST_PATHS = [ + '../../tests/white-box/*.rb', + '/srv/leap/files/tests/white-box/*.rb' +] + +## +## UTILITY +## + def bail(code, msg=nil) puts msg if msg if code.is_a? Symbol @@ -35,10 +49,6 @@ def bail(code, msg=nil) end end -## -## UTILITY -## - def service?(service) $node["services"].include?(service.to_s) end @@ -417,21 +427,25 @@ end def main # load node data from hiera file - if File.exists?('/etc/leap/hiera.yaml') - $node = YAML.load_file('/etc/leap/hiera.yaml') + if File.exists?(HIERA_FILE) + $node = YAML.load_file(HIERA_FILE) else $node = {"services" => [], "dummy" => true} end # 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 + HELPER_PATHS.each do |path| + Dir[File.expand_path(path, this_file)].each do |helper| + require helper + end end - Dir[File.expand_path('../../tests/white-box/*.rb', this_file)].each do |test_file| - begin - require test_file - rescue SkipTest + TEST_PATHS.each do |path| + Dir[File.expand_path(path, this_file)].each do |test_file| + begin + require test_file + rescue SkipTest + end end end |