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

[kitchen] Use busser-rspec_datadog gem for tests #15271

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions test/kitchen/drivers/azure-driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,6 @@ platforms:
username: <%= vm_username %>
password: <%= vm_password %>

lifecycle:
# HACK: this is needed to install rexml for system-probe tests without using bundler, which cannot be used for now
# (see the explanation in tasks/run-test-kitchen.sh).
pre_verify:
- local: echo 'Installing rexml gem for the system-probe-test suite'
<% if windows %>
- remote: C:/opscode/chef/embedded/bin/gem.bat install rexml --install-dir C:/Users/<%= vm_username %>/AppData/Local/Temp/verifier/gems
<% else %>
- remote: /opt/chef/embedded/bin/gem install rexml --install-dir /tmp/verifier/gems
<% end %>

transport:
<% if windows %>
name: winrm
Expand Down
9 changes: 0 additions & 9 deletions test/kitchen/drivers/ec2-driver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,6 @@ platforms:
let i+=${wait};
done;
<% end %>
# HACK: this is needed to install rexml for system-probe tests without using bundler, which cannot be used for now
# (see the explanation in tasks/run-test-kitchen.sh).
pre_verify:
- local: echo 'Installing rexml gem for the system-probe-test suite'
<% if windows %>
- remote: C:/opscode/chef/embedded/bin/gem.bat install rexml --install-dir C:/Users/ec2-user/AppData/Local/Temp/verifier/gems
<% else %>
- remote: /opt/chef/embedded/bin/gem install rexml --install-dir /tmp/verifier/gems
<% end %>
verifier:
downloads:
"/tmp/junit.tar.gz": kitchen-junit-<%= platform_name %>.tar.gz
Expand Down
21 changes: 3 additions & 18 deletions test/kitchen/tasks/run-test-kitchen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,8 @@ set +o pipefail
test_suites=".*"
# This for loop retries kitchen tests failing because of infrastructure/networking issues
for attempt in $(seq 0 "${KITCHEN_INFRASTRUCTURE_FLAKES_RETRY:-2}"); do
bundle exec kitchen converge "$test_suites" -c -d always 2>&1 | tee "/tmp/runlog${attempt}"
converge_result=${PIPESTATUS[0]}

# HACK: Since December 24, 2022, the first verify attempt always fails, due to a bundler <-> ruby
# version issue at the start of the verifier.
# The kitchen verifier uses the latest version of busser (0.8.0). busser detects that we have rspec tests,
# and therefore installs the latest version of the busser-rspec gem (0.7.6).
# The busser-rspec gem has a postinstall hook that installs the latest versions of the rspec and bundler gems.
# The rspec install goes fine, but the bundler install fails since December 24, 2022, when 2.4.0 of bundler
# was released, which drops support for ruby < 2.6.
# Running kitchen verify another time does work, because the postinstall hook isn't run again,
# and we don't actually need bundler in the test suites (for suites that do have depedencies, we install them
# manually with lifecycle hooks in the platform definitions).
bundle exec kitchen verify "$test_suites" --no-log-overwrite -c -d always 2>&1 || true

bundle exec kitchen verify "$test_suites" --no-log-overwrite -c -d always 2>&1 | tee -a "/tmp/runlog${attempt}"
verify_result=${PIPESTATUS[0]}
bundle exec kitchen verify "$test_suites" -c -d always 2>&1 | tee "/tmp/runlog${attempt}"
result=${PIPESTATUS[0]}

# Before destroying the kitchen machines, get the list of failed suites,
# as their status will be reset to non-failing once they're destroyed.
Expand All @@ -186,7 +171,7 @@ for attempt in $(seq 0 "${KITCHEN_INFRASTRUCTURE_FLAKES_RETRY:-2}"); do
break
fi

if [ "$converge_result" -eq 0 ] && [ "$verify_result" -eq 0 ]; then
if [ "$result" -eq 0 ]; then
# if kitchen test succeeded, exit with 0
exit 0
else
Expand Down
1 change: 0 additions & 1 deletion test/kitchen/test/integration/chef/rspec/spec_helper.rb

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

gem 'rspec'
gem 'rexml'

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.