Skip to content

Commit

Permalink
Support nightly repository version
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms authored and evgeni committed Nov 16, 2023
1 parent ca2ec50 commit 65f3131
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
2 changes: 1 addition & 1 deletion manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# @param version
# The Pulpcore version to use
class pulpcore::repo (
Pattern['^\d+\.\d+$'] $version = '3.28',
Variant[Enum['nightly'], Pattern['^\d+\.\d+$']] $version = '3.28',
) {
$dist_tag = "el${facts['os']['release']['major']}"
$context = {
Expand Down
49 changes: 33 additions & 16 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,43 @@
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile.with_all_deps }
it do
is_expected.to contain_anchor('pulpcore::repo')
is_expected.to contain_file('/etc/yum.repos.d/pulpcore.repo')
.with_content(%r{^baseurl=https://yum.theforeman.org/pulpcore/\d+\.\d+/el\d+/\$basearch$})
.that_notifies('Anchor[pulpcore::repo]')
describe "with default values" do
it { is_expected.to compile.with_all_deps }
it do
is_expected.to contain_anchor('pulpcore::repo')
is_expected.to contain_file('/etc/yum.repos.d/pulpcore.repo')
.with_content(%r{^baseurl=https://yum.theforeman.org/pulpcore/\d+\.\d+/el\d+/\$basearch$})
.that_notifies('Anchor[pulpcore::repo]')
end

if os_facts[:os]['release']['major'] == '8'
it 'configures the pulpcore module' do
is_expected.to contain_package('pulpcore-dnf-module')
.with_name('pulpcore')
.with_ensure(/^el\d+/)
.with_enable_only(true)
.with_provider('dnfmodule')
.that_requires('File[/etc/yum.repos.d/pulpcore.repo]')
.that_notifies('Anchor[pulpcore::repo]')
end
else
it { is_expected.not_to contain_package('pulpcore-dnf-module') }
end
end

if os_facts[:os]['release']['major'] == '8'
it 'configures the pulpcore module' do
is_expected.to contain_package('pulpcore-dnf-module')
.with_name('pulpcore')
.with_ensure(/^el\d+/)
.with_enable_only(true)
.with_provider('dnfmodule')
.that_requires('File[/etc/yum.repos.d/pulpcore.repo]')
describe "with nightly version" do
let :params do
{
version: 'nightly'
}
end

it { is_expected.to compile.with_all_deps }
it do
is_expected.to contain_file('/etc/yum.repos.d/pulpcore.repo')
.with_content(%r{^baseurl=https://yum.theforeman.org/pulpcore/nightly/el\d+/\$basearch$})
.that_notifies('Anchor[pulpcore::repo]')
end
else
it { is_expected.not_to contain_package('pulpcore-dnf-module') }
end
end
end
Expand Down

0 comments on commit 65f3131

Please sign in to comment.