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

Remove invalid default for $katello::repo::repo_version #487

Merged
merged 2 commits 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
4 changes: 2 additions & 2 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# @summary Manage the Katello repository
#
# @param repo_version
# The repository version to use. Either latest or a version like 3.14.
# The repository version to use
# @param dist
# The distribution to use
# @param gpgcheck
# Whether GPG signatures need to be checked
# @param gpgkey
# The location of the GPG key
class katello::repo (
String $repo_version = latest,
Variant[Pattern[/^\d\.\d+$/], Enum['nightly']] $repo_version,
String $dist = "el${facts['os']['release']['major']}",
Boolean $gpgcheck = false,
String $gpgkey = 'absent',
Expand Down
8 changes: 7 additions & 1 deletion spec/classes/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ class { 'katello::params':
end

context 'with repo present' do
let(:pre_condition) { 'include katello::repo' }
let(:pre_condition) do
<<~PUPPET
class { 'katello::repo':
repo_version => 'nightly',
}
PUPPET
end

it { is_expected.to compile.with_all_deps }

Expand Down
20 changes: 13 additions & 7 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
require 'spec_helper'

describe 'katello::repo' do
let(:facts) { { os: { release: { major: '8' } } } }

context 'with default parameters' do
let(:facts) { { os: { release: { major: '8' } } } }
it { is_expected.to compile.and_raise_error(//) }
end

context 'with nightly repo' do
let :params do
{
'repo_version' => 'nightly',
}
end

it do
is_expected.to contain_yumrepo('katello')
.with_descr('katello latest')
.with_baseurl("https://yum.theforeman.org/katello/latest/katello/el8/\$basearch/")
.with_descr('katello nightly')
.with_baseurl("https://yum.theforeman.org/katello/nightly/katello/el8/\$basearch/")
.with_gpgkey('absent')
.with_gpgcheck(false)
.with_enabled(true)
Expand All @@ -17,8 +27,6 @@
end

context 'with manage_repo => true' do
let(:facts) { { os: { release: { major: '8' } } } }

let :params do
{
'repo_version' => '3.14',
Expand All @@ -38,8 +46,6 @@
end
end
context 'with manage_repo => true on EL8 with modular metadata' do
let(:facts) { { os: { release: { major: '8' } } } }

let :params do
{
'repo_version' => 'nightly',
Expand Down