Skip to content

Commit

Permalink
add dnfmodule repo implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeni committed Oct 29, 2023
1 parent 7c26002 commit c543c11
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
23 changes: 23 additions & 0 deletions manifests/repo/dnfmodule.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# @summary Manage the DNF module
#
# On EL8+ DNF can manage modules.
# This is a method of providing multiple versions on the same OS.
# Only one DNF module stream can be active at the same time.
#
# @param ensure
# Value of ensure parameter for nodejs dnf module package
#
# @param module
# Name of the nodejs dnf package
#
# @api private
class nodejs::repo::dnfmodule (
String[1] $ensure = $nodejs::repo_version,
String[1] $module = 'nodejs',
) {
package { 'nodejs dnf module':
ensure => $ensure,
name => $module,
provider => 'dnfmodule',
}
}
36 changes: 36 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,42 @@ 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'

# Node 20 is only available in Stream yet, not in a released EL
# So we're testing 18 here
it_behaves_like 'an idempotent resource' do
let(:manifest) do
<<-PUPPET
class { 'nodejs':
nodejs_dev_package_ensure => installed,
npm_package_ensure => installed,
repo_class => 'nodejs::repo::dnfmodule',
repo_version => '18',
}
PUPPET
end
end

%w[
npm
nodejs
nodejs-devel
].each do |pkg|
describe package(pkg) do
it do

Check failure on line 92 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "npm" is expected to be installed Failure/Error: is_expected.to be_installed expected Package "npm" to be installed

Check failure on line 92 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "nodejs" is expected to be installed Failure/Error: is_expected.to be_installed expected Package "nodejs" to be installed

Check failure on line 92 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "nodejs-devel" is expected to be installed Failure/Error: is_expected.to be_installed expected Package "nodejs-devel" to be installed

Check failure on line 92 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "npm" is expected to be installed Failure/Error: is_expected.to be_installed expected Package "npm" to be installed

Check failure on line 92 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "nodejs" is expected to be installed Failure/Error: is_expected.to be_installed expected Package "nodejs" to be installed

Check failure on line 92 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "nodejs-devel" is expected to be installed Failure/Error: is_expected.to be_installed expected Package "nodejs-devel" to be installed
is_expected.to be_installed
end

it 'comes from the expected source' do

Check failure on line 96 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "npm" comes from the expected source Failure/Error: pkg_output = shell(pkg_cmd) Beaker::Host::CommandFailure: Host 'centos8-64-puppet8.example.com' exited with 1 running: yum info nodejs | grep "^From repo" Last 10 lines of output were:

Check failure on line 96 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "nodejs" comes from the expected source Failure/Error: pkg_output = shell(pkg_cmd) Beaker::Host::CommandFailure: Host 'centos8-64-puppet8.example.com' exited with 1 running: yum info nodejs | grep "^From repo" Last 10 lines of output were:

Check failure on line 96 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 8 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "nodejs-devel" comes from the expected source Failure/Error: pkg_output = shell(pkg_cmd) Beaker::Host::CommandFailure: Host 'centos8-64-puppet8.example.com' exited with 1 running: yum info nodejs | grep "^From repo" Last 10 lines of output were:

Check failure on line 96 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "npm" comes from the expected source Failure/Error: pkg_output = shell(pkg_cmd) Beaker::Host::CommandFailure: Host 'centos8-64-puppet7.example.com' exited with 1 running: yum info nodejs | grep "^From repo" Last 10 lines of output were:

Check failure on line 96 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "nodejs" comes from the expected source Failure/Error: pkg_output = shell(pkg_cmd) Beaker::Host::CommandFailure: Host 'centos8-64-puppet7.example.com' exited with 1 running: yum info nodejs | grep "^From repo" Last 10 lines of output were:

Check failure on line 96 in spec/acceptance/class_spec.rb

View workflow job for this annotation

GitHub Actions / Puppet / 7 - CentOS 8

nodejs RedHat with repo_class => nodejs::repo::dnfmodule Package "nodejs-devel" comes from the expected source Failure/Error: pkg_output = shell(pkg_cmd) Beaker::Host::CommandFailure: Host 'centos8-64-puppet7.example.com' exited with 1 running: yum info nodejs | grep "^From repo" Last 10 lines of output were:
pkg_output = shell(pkg_cmd)
expect(pkg_output.stdout).to match 'appstream'
end
end
end
end

context 'Debian distribution packages', if: fact('os.family') == 'Debian' do
before(:context) { purge_node }

Expand Down

0 comments on commit c543c11

Please sign in to comment.