Skip to content

Instantly share code, notes, and snippets.

@justinstoller
Created September 26, 2013 16:57
Show Gist options
  • Save justinstoller/6717051 to your computer and use it in GitHub Desktop.
Save justinstoller/6717051 to your computer and use it in GitHub Desktop.
QE-245
# Attempt to debug https://github.com/hunner/puppetlabs-haproxy/blob/beaker/spec/acceptance/single_node/basic_spec.rb
# Using the default TestUnit assertions. This all passes locally.
# I've included commented out failing cases to show the converse,
# including the result reported in the final test summary
test_name "let's experiment" do
step "test on and friends yield symantics" do
my_manifest = %q{
notify { 'blah': }
exec { '/bin/true': }
}
apply_manifest_on master, my_manifest do |r|
assert [0,2].include? r.exit_code
# assert [5,7].include? r.exit_code
# Test Case blah.rb reported: #<MiniTest::Assertion: Failed assertion, no message given.>
end
on master, '/bin/true' do |result|
assert_equal 0, result.exit_code
# assert_not_equal 0, result.exit_code
# Test Case blah.rb reported: #<MiniTest::Assertion: <0> expected to be != to <0>.>
end
on master, 'yaddayaddayadda', acceptable_exit_codes: 0..127 do |r|
assert_match /command not found/, r.stderr
# assert_match /blahblbablah/, r.stdout
# Test Case blah.rb reported: #<MiniTest::Assertion: Expected /blahblbablah/ to match "".>
end
assert_raise RuntimeError do
# The fact that this raises a RuntimeError is a bug
# (It should raise a Beaker::DSL::FailTest exception)
on master, 'blahblahblah'
# on master, '/bin/true'
# Test Case blah.rb reported: #<MiniTest::Assertion: RuntimeError expected but nothing was raised.>
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment