diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a077911..21b6ad03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,7 @@ concurrency: jobs: puppet: name: Puppet - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 with: pidfile_workaround: 'false' + beaker_facter: 'nodejs_version:NodeJS:16,18,20' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 15f17213..55324aa6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 with: allowed_owner: 'voxpupuli' secrets: diff --git a/.msync.yml b/.msync.yml index dd3e9572..76cd4646 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '7.0.0' +modulesync_config_version: '7.1.0' diff --git a/.sync.yml b/.sync.yml index 4cf442c8..6520a600 100644 --- a/.sync.yml +++ b/.sync.yml @@ -3,3 +3,5 @@ spec/spec_helper.rb: mock_with: ':mocha' spec/spec_helper_acceptance.rb: unmanaged: true +.github/workflows/ci.yml: + beaker_facter: 'nodejs_version:NodeJS:16,18,20' diff --git a/Gemfile b/Gemfile index db21d3b5..f8aae124 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ group :test do gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 3.0', :require => false + gem 'puppet_metadata', '~> 3.5', :require => false end group :development do @@ -16,13 +16,11 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 2.0', :require => false + gem 'voxpupuli-acceptance', '~> 2.2', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false - gem 'voxpupuli-release', '~> 3.0', :require => false - gem 'faraday-retry', '~> 2.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false end gem 'rake', :require => false diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index a57e1298..6841c736 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -10,6 +10,8 @@ pkg_cmd = 'dpkg -s nodejs | grep "^Maintainer"' end + nodejs_version = ENV.fetch('BEAKER_FACTER_nodejs_version', '20') + context 'default parameters' do it_behaves_like 'an idempotent resource' do let(:manifest) { "class { 'nodejs': }" } @@ -27,6 +29,45 @@ end end + context "explicitly using version #{nodejs_version} from nodesource", if: %w[RedHat Debian].include?(fact('os.family')), skip: (nodejs_version != '16' && fact('os.family') == 'RedHat' && fact('os.release.major') == '7' ? 'Only NodeJS 16 is supported on EL7' : nil) do + # Only nodejs 16 is supported on EL7 by nodesource + + include_examples 'cleanup' + + # Debian 12 contains NodeJS 18, when we test 16, we need to force the nodesource version + repo_pin = + if nodejs_version == '16' && fact('os.family') == 'Debian' && fact('os.release.major') == '12' + '1000' + else + 'undef' + end + + it_behaves_like 'an idempotent resource' do + let(:manifest) do + <<-PUPPET + class { 'nodejs': + repo_version => '#{nodejs_version}', + repo_pin => #{repo_pin}, + } + PUPPET + end + end + + describe package('nodejs') do + it { is_expected.to be_installed } + + it 'comes from the expected source' do + pkg_output = shell(pkg_cmd) + expect(pkg_output.stdout).to match 'nodesource' + end + end + + describe command('node --version') do + its(:exit_status) { is_expected.to eq 0 } + its(:stdout) { is_expected.to match(%r{^v#{nodejs_version}}) } + end + end + context 'RedHat with repo_class => epel', if: fact('os.family') == 'RedHat' do include_examples 'cleanup' @@ -65,12 +106,11 @@ class { 'nodejs': end end - context 'RedHat with repo_class => nodejs::repo::dnfmodule', if: fact('os.family') == 'RedHat' && %w[8 9].include?(fact('os.release.major')) do - include_examples 'cleanup' - + context 'RedHat with repo_class => nodejs::repo::dnfmodule', if: fact('os.family') == 'RedHat' && %w[8 9].include?(fact('os.release.major')), skip: ((nodejs_version == '20' && fact('os.name') != 'CentOS') || (nodejs_version == '16' && fact('os.release.major') == '9') ? 'NodeJS 20 is not yet in a released EL, NodeJS 16 is not available on EL9' : nil) do # Node 20 is only available in Stream yet, not in a released EL - # So we're testing 18 here - nodejs_version = '18' + # Node 16 is not available on EL9 + + include_examples 'cleanup' it_behaves_like 'an idempotent resource' do let(:manifest) do