Skip to content

Commit

Permalink
Merge pull request #1366 from puppetlabs/CAT-1832
Browse files Browse the repository at this point in the history
(CAT-1832) Fix test failures
  • Loading branch information
jordanbreen28 authored Jun 11, 2024
2 parents bfacb84 + 94ce3cf commit ef19b63
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion package-testing/spec/package/airgapped_usage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

context 'when validating the module' do
context "with puppet #{PDK_VERSION[:latest][:major]}" do
let(:ruby_version) { ruby_for_puppet(PDK_VERSION[:latest][:major]) }

describe command("pdk validate --puppet-version=#{PDK_VERSION[:latest][:major]}") do
let(:cwd) { module_name }

Expand All @@ -42,7 +44,7 @@
subject { super().content.gsub(/^DEPENDENCIES.+?\n\n/m, '') }

it 'is identical to the vendored lockfile' do
vendored_lockfile = File.join(install_dir, 'share', 'cache', "Gemfile-#{PDK_VERSION[:latest][:ruby]}.lock")
vendored_lockfile = File.join(install_dir, 'share', 'cache', "Gemfile-#{ruby_version}.lock")

expect(subject).to eq(file(vendored_lockfile).content.gsub(/^DEPENDENCIES.+?\n\n/m, ''))
end
Expand Down
10 changes: 5 additions & 5 deletions package-testing/spec/package/support/spec_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ def latest_ruby

def ruby_for_puppet(pupver)
ruby_pattern = case pupver
when /^4\./ then '2.1.*'
when /^5\./ then '2.4.*'
when /^6\./ then '2.5.*'
when /^7\./ then '2.7.*'
when /^8\./ then '3.2.*'
when /^4/ then '2.1.*'
when /^5/ then '2.4.*'
when /^6/ then '2.5.*'
when /^7/ then '2.7.*'
when /^8/ then '3.2.*'
end

return unless ruby_pattern
Expand Down
4 changes: 3 additions & 1 deletion package-testing/spec/package/validate_a_new_module_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

context 'when validating the module' do
context "with puppet #{PDK_VERSION[:latest][:major]}" do
let(:ruby_version) { ruby_for_puppet(PDK_VERSION[:latest][:major]) }

describe command("pdk validate --puppet-version=#{PDK_VERSION[:latest][:major]}") do
let(:cwd) { module_name }

Expand All @@ -32,7 +34,7 @@
subject { super().content.gsub(/^DEPENDENCIES.+?\n\n/m, '') }

it 'is identical to the vendored lockfile' do
vendored_lockfile = File.join(install_dir, 'share', 'cache', "Gemfile-#{PDK_VERSION[:latest][:ruby]}.lock")
vendored_lockfile = File.join(install_dir, 'share', 'cache', "Gemfile-#{ruby_version}.lock")

expect(subject).to eq(file(vendored_lockfile).content.gsub(/^DEPENDENCIES.+?\n\n/m, ''))
end
Expand Down

0 comments on commit ef19b63

Please sign in to comment.