Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci:test:aio skips the post-suite if any tests fail, but ci:test:aio[true] doesn't #237

Closed
joshcooper opened this issue Jan 22, 2024 · 0 comments · Fixed by #238
Closed
Labels

Comments

@joshcooper
Copy link
Contributor

joshcooper commented Jan 22, 2024

Describe the Bug

When running the ci:test:aio rake task (with retries disabled), if any test fails, then the post-suite is skipped:

beaker-puppet/tasks/ci.rake

Lines 320 to 323 in 5f0984a

beaker(:exec, ENV.fetch('TESTS', nil))
beaker(:exec, 'post-suite')
ensure
preserve_hosts = ENV['OPTIONS'].include?('--preserve-hosts=always') if ENV['OPTIONS']

This is because beaker(:exec, ...) raises if any test fails and the post-suite isn't in an ensure block.

However, ci:test:aio[true] (with retries enabled) does execute the post-suite, because it's been moved to the ensure block.

beaker-puppet/tasks/ci.rake

Lines 348 to 349 in 5f0984a

ensure
beaker(:exec, 'post-suite')

Expected Behavior

The post-suite should always be executed irrespective of whether retries are enabled or not.

Also if the post-suite fails/raises, then we should ensure hosts are still destroyed too

Steps to Reproduce

Steps to reproduce the behavior:

git clone https://github.com/puppetlabs/facter
cd facter
patch -p1 << 'EOF' 
diff --git a/acceptance/tests/load_libfacter.rb b/acceptance/tests/load_libfacter.rb
index 1bc61ffd1..fe93a25bb 100644
--- a/acceptance/tests/load_libfacter.rb
+++ b/acceptance/tests/load_libfacter.rb
@@ -2,6 +2,8 @@
 test_name 'C100161: Ruby can load libfacter without raising an error' do
   tag 'risk:high'

+  raise "Whoops"
+
   require 'puppet/acceptance/common_utils'
   extend Puppet::Acceptance::CommandUtils
EOF
cd acceptance
bundle install
bundle exec rake ci:test:aio SHA=8.4.0 TESTS=tests/load_libfacter.rb HOSTS=redhat8-64a
...
...notice `bundle exec beker exec post-suite` is never executed
...

But when retries are enabled, the post-suite is executed:

bundle exec rake 'ci:test:aio[true]' SHA=8.4.0 TESTS=tests/load_libfacter.rb HOSTS=redhat8-64a

Environment

bundle exec gem list

*** LOCAL GEMS ***

ansi (1.5.0)
ast (2.4.2)
bcrypt_pbkdf (1.1.0)
beaker (4.41.2)
beaker-abs (0.11.0)
beaker-hostgenerator (2.9.0)
beaker-puppet (1.29.0)
beaker-vagrant (0.7.1)
beaker-vmpooler (1.4.0)
bundler (2.4.19)
commander (4.6.0)
deep_merge (1.2.2)
ed25519 (1.3.0)
faraday (1.10.3)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
highline (2.0.3)
hocon (1.4.0)
in-parallel (0.1.17)
inifile (3.0.0)
minitar (0.9)
minitest (5.21.2)
multi_json (1.15.0)
multipart-post (2.3.0)
net-scp (4.0.0)
net-ssh (7.2.1)
oga (3.4)
rake (13.1.0)
rexml (3.2.6)
rsync (1.0.9)
ruby-ll (2.1.3)
ruby2_keywords (default: 0.0.5)
stringify-hash (0.0.2)
thor (1.3.0)
vmfloaty (1.8.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant