Skip to content

Commit

Permalink
Add basic spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesps-ebi committed Mar 25, 2024
1 parent 59f4a99 commit d7c0166
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion spec/defines/source_deb822_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,48 @@

describe 'apt::source_deb822' do
let(:title) { 'namevar' }
let(:pre_condition) { 'include apt' }
let(:params) do
{}
end

context 'with defaults' do
it { is_expected.to raise_error(Puppet::Error) }
end

on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }

it { is_expected.to compile }
context 'puppetlabs source' do
let(:title) { 'puppetlabs' }
let(:params) do
super().merge(
{
'comment' => 'Manage the puppetlabs repo',
'uris' => ['http://apt.puppet.com'],
'suites' => [facts['codename'].to_s],
'components' => ['puppet8'],
'signed_by' => ['/etc/apt/keyrings/puppetlabs.gpg'],
},
)
end

it { is_expected.to contain_apt__setting("source-#{title}") }
it { is_expected.to contain_file("/etc/apt/sources.list.d/#{title}.sources").with_content(%r{^# #{params['comment']}}) }

context 'disable repo' do
let(:params) do
super().merge(
{
'enabled' => false,
},
)
end

it { is_expected.to contain_file("/etc/apt/sources.list.d/#{title}.sources").with_content(%r{^Enabled: no}) }
end
end
end
end
end

0 comments on commit d7c0166

Please sign in to comment.