(PE-43839) Add acceptance test for puppet8 to puppet9 agent upgrade#838
Open
span786 wants to merge 3 commits into
Open
(PE-43839) Add acceptance test for puppet8 to puppet9 agent upgrade#838span786 wants to merge 3 commits into
span786 wants to merge 3 commits into
Conversation
Adds tests/test_upgrade_puppet8_to_puppet9.rb modeled on the existing 7→8 test, with adjustments for the puppet9-nightly track: - require_master_collection min: 'puppet8' (puppet_collection_for strips the -nightly suffix, so compare against the bare collection name) - Version assertion accepts 8.99.99.x.gSHA (Puppet's next-major pre-release versioning) alongside the eventual 9.x.y stable form - curl_passing_sha helper with retries; fails the test rather than silently degrading on a VPN blip - Routes the initial puppet-agent install through dev_builds_url by passing the full SHA from passing-agent-SHAs/puppet-agent-8.x, so newer agent platforms (e.g. macOS 26) that have no build at downloads.puppet.com/mac/puppet8/<os> can still be tested - Dumps full puppet apply output on non-2 exit (beaker default truncates to last 10 lines) Rakefile: add UPGRADE_TARGET_COLLECTION env-var dispatch so test selection is decoupled from MASTER_COLLECTION. Lets the master run a puppet8 puppetserver (since puppetserver-9 nightlies aren't published yet) while still running the 8→9 upgrade test. helpers.rb: fix dormant bug in collection_cmp — Symbol#casecmp(String) returns nil on Ruby 3.2, crashing the min:/max: form of require_master_collection. The 7→8 test uses the String form so this code path was never exercised before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Replace `lambda do |name| ... end` with `->(name) do ... end` - Single-quote the non-interpolated `=== end output ===` log line Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new Beaker acceptance test to exercise upgrading agents from Puppet 8 to Puppet 9 nightlies, and updates the acceptance harness to select the appropriate upgrade scenario independently of the master’s collection. It also fixes a Ruby 3.2 compatibility issue in collection comparison used by require_master_collection range checks.
Changes:
- Add
test_upgrade_puppet8_to_puppet9.rb, mirroring the existing 7→8 upgrade test with puppet9-nightly specifics and stronger SHA/version fetch handling. - Update
acceptance/Rakefileto select the upgrade test based onUPGRADE_TARGET_COLLECTION(fallback toMASTER_COLLECTION). - Fix
collection_cmpinacceptance/helpers.rbby comparing collections as strings (avoidsSymbol#casecmpreturningnilon Ruby 3.2).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| acceptance/tests/test_upgrade_puppet8_to_puppet9.rb | New acceptance test for puppet-agent 8→9 upgrade, including SHA/version lookup and version assertions. |
| acceptance/Rakefile | Add env-var dispatch to choose the correct upgrade test for CI runs. |
| acceptance/helpers.rb | Fix collection comparison to avoid Ruby 3.2 Symbol#casecmp behavior in range-based collection gating. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Replace shell-out to `curl` with Ruby `open-uri` for the passing-agent-SHAs fetch. `curl --retry-connrefused` isn't supported on older curl (e.g. 7.29 on CentOS 7) and silently fails to retry, producing a misleading "check VPN" message. The Ruby version retries in-process and surfaces the actual error (HTTP status, timeout, SocketError) in the failure message. - Normalize blank env vars in the Rakefile dispatch. An empty string is truthy in Ruby, so `ENV['UPGRADE_TARGET_COLLECTION'] || ENV['MASTER_COLLECTION']` would have selected no test when the first was set but blank. Now both are `.to_s.strip`'d and treated as unset when empty. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
acceptance/tests/test_upgrade_puppet8_to_puppet9.rb, mirroring the existing 7→8 test, with adjustments for the puppet9-nightly track (pre-release8.99.99.x.gSHAversions, dev_builds routing for newer agent platforms like macOS 26 Intel that have no build atdownloads.puppet.com/mac/puppet8/<os>).acceptance/Rakefile: newUPGRADE_TARGET_COLLECTIONenv-var dispatch so the test selected is decoupled fromMASTER_COLLECTION. Needed because puppetserver-9 nightlies aren't yet published, so the master has to stay on puppet8-nightly while still exercising the 8→9 upgrade.acceptance/helpers.rb: fix dormant bug incollection_cmp—Symbol#casecmp(String)returnsnilon Ruby 3.2, crashing themin:/max:form ofrequire_master_collection. The 7→8 test only uses theStringform so this code path was never exercised.Related: PE-43839
Test plan
rake ciagainst ABS-provisioned puppet8-nightly master + macOS 26 Intel agent —Passed: 1, Failed: 0, Errored: 0acceptance/tests/test_upgrade_puppet7_to_puppet8.rbstill works (Rakefile dispatch defaults toMASTER_COLLECTIONwhenUPGRADE_TARGET_COLLECTIONis unset, preserving existing behaviour)ruby -csyntax-check on the new test fileinternal_nightly__local/yum, dropUPGRADE_TARGET_COLLECTIONand switchMASTER_COLLECTION=puppet9-nightlyto test the full puppet9 master pathHow to run
🤖 Generated with Claude Code