summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/run_tests40
-rw-r--r--platform.rb4
2 files changed, 30 insertions, 14 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
diff --git a/platform.rb b/platform.rb
index c37b6d29..26b17465 100644
--- a/platform.rb
+++ b/platform.rb
@@ -52,10 +52,12 @@ Leap::Platform.define do
:soledad_service_json_template => 'files/service-definitions/#{arg}/soledad-service.json.erb',
:smtp_service_json_template => 'files/service-definitions/#{arg}/smtp-service.json.erb',
- # custom puppet
+ # custom files
:custom_puppet_dir => 'files/puppet',
:custom_puppet_modules_dir => 'files/puppet/modules',
:custom_puppet_manifests_dir => 'files/puppet/manifests',
+ :custom_tests => 'files/tests',
+ :custom_bin => 'files/bin',
# output files
:facts => 'facts.json',