Skip to content

Modernize testing toolchain (voxpupuli-test 9.2.1, beaker ~> 6.9) - #455

Closed
justmedude wants to merge 3 commits into
ghoneycutt:mainfrom
justmedude:gem-modernization
Closed

justmedude wants to merge 3 commits into
ghoneycutt:mainfrom
justmedude:gem-modernization

Conversation

@justmedude

@justmedude justmedude commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Modernizes the pinned voxpupuli-test (6.0.0 -> 9.2.1) and beaker (~> 4.29 -> ~> 6.9) gems, picking up current facterdb fact data and beaker's Beaker::Platform-based package resolution, while staying compatible with the Ruby 2.7.8 CI legs this module still tests against.

Opened as a draft to get early feedback / CI signal before final review, and kept separate from other in-flight PRs since this is a general tooling/CI concern rather than an OS-support addition.

Changes

  • Gemfile: voxpupuli-test capped at 9.2.1 and beaker at ~> 6.9, rather than jumping to their absolute latest. Both gems' newest versions require Ruby >= 3.2 transitively (via puppetlabs_spec_helper >= 9.0.0 and beaker >= 7.0 respectively), which breaks every CI job still running on Ruby 2.7.8 (the legacy puppet7 unit leg and all acceptance jobs). These caps are the newest versions that stay Ruby-2.7-compatible: beaker 6.9.0 already includes the Beaker::Platform-based package resolution (with an explicit Ubuntu 26.04/"resolute" mapping) that motivated the bump, and voxpupuli-test 9.2.1 still resolves facterdb to 3.10.0, fixing the original RedHat 7 fact-data gap.
  • Gemfile: also pin json to ~> 2.3.0 on Ruby 2.7 specifically. The bumped rubocop (1.50.2, pulled in transitively) depends on a real json gem, so Bundler installs json 2.21.2 instead of relying on Ruby 2.7.8's bundled default (2.3.0) -- and that newer json breaks Puppet 7.34's deprecated PSON compatibility shim (NameError: constant PSON::Parser not defined during rake syntax). Confirmed this is new (doesn't happen with the original pins) and that pinning json back down fixes it, with no effect on Puppet 8 / Ruby 3.2 where json still resolves freely.
  • Rakefile: drop the redundant require 'puppet-syntax/tasks/puppet-syntax'puppetlabs_spec_helper has auto-required it itself since at least 8.0.0, so the explicit require was always redundant and caused duplicate syntax:manifests task registration.
  • spec/classes/init_spec.rb, spec/defines/config_entry_spec.rb: the "OS independent, only test one" fixtures move off RedHat 7 (no fact data even at facterdb 3.10.0) to RedHat 8, matching the existing convention already used in spec/classes/server_spec.rb.
  • spec/fixtures/testing/Archlinux-_ssh(d)_config: renamed to Archlinux-6_ssh(d)_configrspec-puppet-facts resolves Archlinux's release to "6" independent of the facterdb version pinned here.

Gemfile.lock is gitignored in this repo, so it's not part of this diff; only the Gemfile version constraints are changed. REFERENCE.md is untouched, since it's only meant to be regenerated by the :release rake task.

Test plan

Verified locally under both Ruby 3.2.9 and Ruby 2.7.8 (built specifically to reproduce the CI legs that were failing):

  • bundle exec rake parallel_spec — 6269 examples, 0 failures, 100% resource coverage (both Ruby versions)
  • bundle exec rake syntax lint validate rubocop metadata_lint — all clean (both Ruby versions)
  • bundle exec rake beaker against ubuntu-2204 under Ruby 2.7.8 — 4 examples, 0 failures, confirming the acceptance path works end-to-end on the Ruby version that was previously failing outright

Known unrelated CI flake

The debian-11 acceptance jobs may fail with a 404 fetching libc-l10n_*.deb from deb.debian.org's security archive. That's an external Debian 11 (oldstable) mirror availability issue, unrelated to this PR -- same category as Ubuntu 26.04's unpublished puppet8-release-resolute.deb blocker on the other open PR.

Bump voxpupuli-test to 14.0.0 and beaker to ~> 7.0 to pick up current
facterdb fact data and beaker's Beaker::Platform-based package
resolution. This surfaced several fixes needed to keep the suite
green:

- manifests/init.pp: change forward_x11_timeout, server_alive_count_max
  and server_alive_interval from Variant[Undef, ...] to
  Optional[Variant[...]] so puppet-lint's params_not_optional_with_undef
  check recognizes them as optional; regenerate REFERENCE.md to match.
- Rakefile: drop the redundant require of the old puppet-syntax gem's
  rake tasks, now that puppetlabs_spec_helper loads the renamed
  puppetlabs-syntax gem itself; having both loaded caused duplicate
  syntax:manifests task registration and Puppet entity-redefinition
  errors.
- .rubocop.yml: remove obsolete RSpec/Capybara/* and RSpec/FactoryBot/*
  entries (those cops moved to separate gems not in this project's
  bundle, and referencing them is now a hard config error); disable
  RSpec/NoExpectationExample for the beaker acceptance spec, which
  uses apply_manifest(..., catch_failures: true) rather than
  expect(...).to as its assertion mechanism.
- spec/classes/init_spec.rb, spec/defines/config_entry_spec.rb: the
  bumped facterdb has no fact data for RedHat 7, so switch the
  OS-independent test fixtures to RedHat 9; add a missing coverage
  assertion for the 50-redhat include-dir file.
- spec/fixtures/testing/Archlinux-_ssh(d)_config: rename to
  Archlinux-6_ssh(d)_config to match the release-qualified fixture
  naming the newer facterdb/rspec-puppet-facts now expects.

Verified locally: rake parallel_spec (6270 examples, 0 failures, 100%
coverage), rake syntax/lint/validate/rubocop/metadata_lint all clean,
and a full rake beaker run against ubuntu-2604 and ubuntu-2204 to
confirm no regressions from the beaker version jump.
@justmedude
justmedude marked this pull request as ready for review September 7, 2026 02:01
Comment thread spec/classes/init_spec.rb Outdated

it { is_expected.to contain_package('openssh-clients') }
it { is_expected.to contain_file('ssh_config_include_dir').with_require(['Package[openssh-clients]']) }
# only needed for 100% resource coverage: redhat-9's module-default config_files entry

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a specific context for this under the following. Adding it here does not make sense because the context is about the manage_packages parameter. If you are just trying to get 100% coverage and not without this, it would be better to just reduce coverage in spec/spec_helper.rb than to make the tests harder to understand.

context "on #{os} with config_files set to a valid hash" do

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks. Rather than shoehorning a coverage-only assertion into the manage_packages context, I moved the "OS independent" test fixture off RedHat 9 to RedHat 8 (matching the convention already used in server_spec.rb), which avoids the config_files-triggered coverage gap entirely — no extra assertion needed. Pushed in 6f2e6af.

Comment thread REFERENCE.md

##### <a name="-ssh--forward_x11_timeout"></a>`forward_x11_timeout`

Data type: `Variant[Undef, String[1], Integer[0]]`

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert changes to this file as it is auto generated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted, thanks — pushed in 6f2e6af.

beaker ~> 7.0 requires Ruby >= 3.2, which broke every CI job still
running on Ruby 2.7.8 (the legacy puppet7 unit leg and all acceptance
jobs) with a hard Bundler dependency conflict. Cap beaker at ~> 6.9
instead: it already contains the Beaker::Platform-based package
resolution (including an explicit Ubuntu 26.04/"resolute" codename
mapping) that motivated the bump, without dropping Ruby 2.7 support.

voxpupuli-test 14.0.0 has the same problem one level removed: its
`puppet-syntax >= 6.0` requirement can only be satisfied by a
puppetlabs_spec_helper >= 9.0.0, which itself requires Ruby >= 3.2.
There's no pin that reconciles that under Ruby 2.7.8, so cap
voxpupuli-test at 9.2.1, the newest version before it started pulling
in puppet-syntax directly. That still resolves facterdb to 3.10.0 (up
from the original 6.0.0 pin's facterdb < 2), which is enough to fix
the original RedHat 7 fact-data gap.

With this narrower toolchain, most of the earlier fallout fixes turned
out to be unnecessary and are reverted:
- manifests/init.pp's Optional[Variant[...]] change: puppet-lint 4.3.0
  (resolved here) doesn't have the newer params_not_optional_with_undef
  check that flagged the original Variant[Undef, ...] form.
- .rubocop.yml's obsolete-cop cleanup: rubocop-rspec 2.20.0 (resolved
  here) predates the Capybara/FactoryBot cop extraction, so the
  original config is still valid (just prints non-fatal namespace
  warnings).
- REFERENCE.md: reverted to the upstream version per review feedback
  -- it's only meant to be regenerated by the maintainer's :release
  rake task, not hand-committed in PRs.

What's still needed even under the older toolchain:
- Rakefile: still drop the redundant require of puppet-syntax's rake
  tasks -- puppetlabs_spec_helper has auto-required them itself since
  at least 8.0.0, so the explicit require was always redundant and
  caused duplicate task registration.
- spec/classes/init_spec.rb, spec/defines/config_entry_spec.rb: the
  "OS independent, only test one" fixtures still need to move off
  RedHat 7 (no fact data even at facterdb 3.10.0) to RedHat 8, matching
  the untouched convention in spec/classes/server_spec.rb. RedHat 8
  has no config_files default, avoiding the coverage-gap-inducing
  interaction with the manage_packages tests that RedHat 9 introduced
  in the previous version of this PR.
- spec/fixtures/testing/Archlinux-_ssh(d)_config: still renamed to
  Archlinux-6_ssh(d)_config -- rspec-puppet-facts resolves Archlinux's
  release to "6" independent of the facterdb version pinned here.

Re-verified locally under both Ruby 3.2.9 and Ruby 2.7.8 (built via
rbenv specifically to reproduce the CI legs that were failing):
rake parallel_spec (6269 examples, 0 failures, 100% coverage under
both), clean syntax/lint/rubocop/metadata_lint under both, and a real
rake beaker run for ubuntu-2204 under Ruby 2.7.8 (4 examples, 0
failures) confirming the acceptance path works end-to-end on the
Ruby version that was previously failing outright.
@justmedude justmedude changed the title Modernize testing toolchain (voxpupuli-test 14.0.0, beaker ~> 7.0) Modernize testing toolchain (voxpupuli-test 9.2.1, beaker ~> 6.9) Sep 12, 2026
The bumped rubocop (1.50.2, pulled in via voxpupuli-test) depends on a
real json gem (~> 2.3), which causes Bundler to install json 2.21.2
instead of relying on Ruby 2.7.8's bundled default (2.3.0). That newer
json gem breaks Puppet 7.34's deprecated PSON compatibility shim during
`rake syntax` with `NameError: constant PSON::Parser not defined` --
confirmed this doesn't happen with the original (pre-bump) gem pins,
and that pinning json back down to ~> 2.3.0 fixes it without changing
anything for Puppet 8 / Ruby 3.2, where json still resolves freely.

Verified locally under both Ruby 3.2.9 and Ruby 2.7.8: rake
parallel_spec (6269 examples, 0 failures, 100% coverage on both), and
clean syntax/lint/rubocop/metadata_lint on both.
@ghoneycutt

Copy link
Copy Markdown
Owner

This was really helpful and the changes have been incorporated in #456

@ghoneycutt ghoneycutt closed this Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants