Skip to content

Commit c86d12c

Browse files
committed
Add unit testing for deb822 sources
1 parent c439579 commit c86d12c

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

spec/defines/source_spec.rb

+59
Original file line numberDiff line numberDiff line change
@@ -416,4 +416,63 @@
416416
it { is_expected.to contain_apt__setting("list-#{title}").with_notify_update(false) }
417417
end
418418
end
419+
420+
describe 'deb822 sources' do
421+
let :params do
422+
{
423+
source_format: 'sources',
424+
}
425+
end
426+
427+
context 'basic deb822 source' do
428+
let :params do
429+
super().merge({
430+
location: ['http://debian.mirror.iweb.ca/debian/'],
431+
repos: ['main', 'contrib', 'non-free']
432+
})
433+
end
434+
435+
it { is_expected.to contain_apt__setting("sources-#{title}").with_notify_update(true) }
436+
end
437+
438+
context 'complex deb822 source' do
439+
let :params do
440+
super().merge({
441+
types: ['deb', 'deb-src'],
442+
location: ['http://fr.debian.org/debian', 'http://de.debian.org/debian'],
443+
release: ['stable', 'stable-updates', 'stable-backports'],
444+
repos: ['main', 'contrib', 'non-free'],
445+
architecture: ['amd64', 'i386'],
446+
allow_unsigned: true,
447+
notify_update: false
448+
})
449+
end
450+
451+
it { is_expected.to contain_apt__setting("sources-#{title}").with_notify_update(false) }
452+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{Enabled: yes}) }
453+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{Types: deb deb-src}) }
454+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{URIs: http://fr.debian.org/debian http://de.debian.org/debian}) }
455+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{Suites: stable stable-updates stable-backports}) }
456+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{Components: main contrib non-free}) }
457+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{Architectures: amd64 i386}) }
458+
it { is_expected.to contain_apt__setting("sources-#{title}").with_content(%r{Trusted: yes}) }
459+
end
460+
461+
context '.list backwards compatibility' do
462+
let :params do
463+
super().merge({
464+
location: 'http://debian.mirror.iweb.ca/debian/',
465+
release: 'unstable',
466+
repos: 'main contrib non-free',
467+
key: {
468+
id: 'A1BD8E9D78F7FE5C3E65D8AF8B48AD6246925553',
469+
server: 'keyserver.ubuntu.com',
470+
},
471+
pin: '-10'
472+
})
473+
end
474+
475+
it { is_expected.to contain_apt__setting("sources-#{title}").with_notify_update(true) }
476+
end
477+
end
419478
end

0 commit comments

Comments
 (0)