3 describe 'apt::source', type: :define do
4 GPG_KEY_ID = '6F6B15509CF8E59E6E469F327F438280EF8D349F'.freeze
12 os: { family: 'Debian', name: 'Debian', release: { major: '8', full: '8.0' } },
14 lsbdistcodename: 'jessie',
19 context 'with mostly defaults' do
22 'include' => { 'deb' => false, 'src' => true },
23 'location' => 'http://debian.mirror.iweb.ca/debian/',
28 is_expected.to contain_apt__setting('list-my_source').with_content(%r{# my_source\ndeb-src http://debian.mirror.iweb.ca/debian/ jessie main\n})
32 context 'with no defaults' do
36 'location' => 'http://debian.mirror.iweb.ca/debian/',
39 'include' => { 'src' => false },
42 'architecture' => 'x86_64',
43 'allow_unsigned' => true,
48 is_expected.to contain_apt__setting('list-my_source').with_content(%r{# foo\ndeb \[arch=x86_64 trusted=yes\] http://debian.mirror.iweb.ca/debian/ sid testing\n})
49 .without_content(%r{deb-src})
53 is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with('ensure' => 'present',
55 'origin' => 'debian.mirror.iweb.ca')
59 is_expected.to contain_apt__key("Add key: #{GPG_KEY_ID} from Apt::Source my_source").that_comes_before('Apt::Setting[list-my_source]').with('ensure' => 'present',
64 context 'when allow_unsigned true' do
67 'include' => { 'src' => false },
68 'location' => 'http://debian.mirror.iweb.ca/debian/',
69 'allow_unsigned' => true,
73 it { is_expected.to contain_apt__setting('list-my_source').with_content(%r{# my_source\ndeb \[trusted=yes\] http://debian.mirror.iweb.ca/debian/ jessie main\n}) }
76 context 'with architecture equals x86_64' do
79 'location' => 'http://debian.mirror.iweb.ca/debian/',
80 'architecture' => 'x86_64',
85 is_expected.to contain_apt__setting('list-my_source').with_content(%r{# my_source\ndeb \[arch=x86_64\] http://debian.mirror.iweb.ca/debian/ jessie main\n})
89 context 'with ensure => absent' do
97 is_expected.to contain_apt__setting('list-my_source').with('ensure' => 'absent')
101 describe 'validation' do
102 context 'with no release' do
105 os: { family: 'Debian', name: 'Debian', release: { major: '8', full: '8.0' } },
111 is_expected.to raise_error(Puppet::Error, %r{lsbdistcodename fact not available: release parameter required})