Please review pull request #214: (maint) end test when no hosts opened by (justinstoller)
Description:
Prior to this breaking test execution when no valid hosts remained after a confine depended on an agreed upon change in behavior (for skip_test to break execution) that has yet to implemented (pending refactor of tests that currently use skip_test).
This corrects that oversight and adds the code that would cause skip_test to break execution but only includes it in the confine method.
- Opened: Fri May 11 20:09:31 UTC 2012
- Based on: puppetlabs:master (1213880aa686ecb3587307b2e8cea2198993edc0)
- Requested merge: justinstoller:maint/master/end_test_when_no_hosts (6316af07957d776ec97760a64abd11a0b5ae9b55)
Diff follows:
diff --git a/lib/test_case.rb b/lib/test_case.rb
index e53a468..120b270 100644
--- a/lib/test_case.rb
+++ b/lib/test_case.rb
@@ -10,6 +10,7 @@ class TestCase
include PuppetCommands
class PendingTest < Exception; end
+ class SkipTest < Exception; end
attr_reader :version, :config, :options, :path, :fail_flag, :usr_home,
:test_status, :exception, :runtime, :result
@@ -39,6 +40,8 @@ def run_test
@exception = e
rescue PendingTest
@test_status = :pending
+ rescue SkipTest
+ @test_status = :skip
rescue StandardError, ScriptError => e
Log.error(e.inspect)
e.backtrace.each { |line| Log.error(line) }
@@ -128,7 +131,10 @@ def confine(type, confines)
raise "Unknown option #{type}"
end
end
- skip_test "No suitable hosts with: #{confines.inspect}" if @hosts.empty?
+ if @hosts.empty?
+ Log.warn "No suitable hosts with: #{confines.inspect}"
+ raise SkipTest
+ end
end
def inspect_host(host, property, value)
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
