summaryrefslogtreecommitdiff
path: root/bin/run_tests
diff options
context:
space:
mode:
Diffstat (limited to 'bin/run_tests')
-rwxr-xr-xbin/run_tests40
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