Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support nightly repository version #318

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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