diff --git a/lib/objects/post_provision_test.rb b/lib/objects/post_provision_test.rb index b45ff20b0..e4659a2f6 100644 --- a/lib/objects/post_provision_test.rb +++ b/lib/objects/post_provision_test.rb @@ -19,17 +19,20 @@ class PostProvisionTest attr_accessor :json_inputs attr_accessor :port attr_accessor :outputs + attr_accessor :all_tests_passed def initialize self.system_ip = get_system_ip self.json_inputs = get_json_inputs self.port = get_port self.outputs = [] + self.all_tests_passed = true end def run test_module puts self.outputs + exit(1) unless all_tests_passed end def test_module @@ -47,7 +50,7 @@ class PostProvisionTest self.outputs << "PASSED: Port #{self.port} is open at #{get_system_ip} (#{get_system_name})!" else self.outputs << "FAILED: Port #{self.port} is closed at #{get_system_ip} (#{get_system_name})!" - exit(1) + self.all_tests_passed = false end end diff --git a/modules/services/unix/ntp/ntp/secgen_test/ntp.rb b/modules/services/unix/ntp/ntp/secgen_test/ntp.rb index b48d8a80b..2f8bcf569 100644 --- a/modules/services/unix/ntp/ntp/secgen_test/ntp.rb +++ b/modules/services/unix/ntp/ntp/secgen_test/ntp.rb @@ -6,12 +6,12 @@ class NTPTest < PostProvisionTest self.module_name = 'ntp' self.module_path = get_module_path(__FILE__) super - self.port = 12 + self.port = 123 end def test_module super - test_ntp_query #TODO + test_ntp_query end def test_ntp_query @@ -19,8 +19,8 @@ class NTPTest < PostProvisionTest time_response = Net::NTP.get(system_ip, port).time self.outputs << "PASSED: NTP responded on UDP port #{port} with #{time_response}" rescue Errno::ECONNREFUSED - self.outputs << "FAILED: unable to connect to #{module_name} on UDP port #{port} " - exit(1) + self.outputs << "FAILED: unable to connect to #{module_name} on UDP port #{port}" + self.all_tests_passed = false end end end diff --git a/secgen.rb b/secgen.rb index 984213201..085c156fa 100644 --- a/secgen.rb +++ b/secgen.rb @@ -358,7 +358,7 @@ def post_provision_tests(project_dir) tests_passed = false Print.err test_output[:stdout].join("\n") Print.err "Post provision tests contained failures!" - Print.err test_output[:stderr].join("\n") + Print.err test_output[:stderr].join("\n") if test_output[:stderr].length > 0 else Print.info test_output[:stdout].join("\n") end