3 describe 'apt::source', type: :define do
4 GPG_KEY_ID = '6F6B15509CF8E59E6E469F327F438280EF8D349F'.freeze
10 context 'mostly defaults' do
13 os: { family: 'Debian', name: 'Debian', release: { major: '7', full: '7.0' } },
15 lsbdistcodename: 'wheezy',
17 puppetversion: Puppet.version,
23 'include' => { 'deb' => false, 'src' => true },
24 'location' => 'http://debian.mirror.iweb.ca/debian/',
29 is_expected.to contain_apt__setting('list-my_source').with_content(%r{# my_source\ndeb-src http://debian.mirror.iweb.ca/debian/ wheezy main\n})
33 context 'no defaults' do
36 os: { family: 'Debian', name: 'Debian', release: { major: '7', full: '7.0' } },
38 lsbdistcodename: 'wheezy',
40 puppetversion: Puppet.version,
46 'location' => 'http://debian.mirror.iweb.ca/debian/',
49 'include' => { 'src' => false },
52 'architecture' => 'x86_64',
53 'allow_unsigned' => true,
58 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})
59 .without_content(%r{deb-src})
63 is_expected.to contain_apt__pin('my_source').that_comes_before('Apt::Setting[list-my_source]').with('ensure' => 'present',
65 'origin' => 'debian.mirror.iweb.ca')
69 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',
74 context 'allow_unsigned true' do
77 os: { family: 'Debian', name: 'Debian', release: { major: '7', full: '7.0' } },
79 lsbdistcodename: 'wheezy',
81 puppetversion: Puppet.version,
86 'include' => { 'src' => false },
87 'location' => 'http://debian.mirror.iweb.ca/debian/',
88 'allow_unsigned' => true,
92 it { is_expected.to contain_apt__setting('list-my_source').with_content(%r{# my_source\ndeb \[trusted=yes\] http://debian.mirror.iweb.ca/debian/ wheezy main\n}) }
95 context 'architecture equals x86_64' do
98 os: { family: 'Debian', name: 'Debian', release: { major: '7', full: '7.0' } },
100 lsbdistcodename: 'wheezy',
102 puppetversion: Puppet.version,
107 'location' => 'http://debian.mirror.iweb.ca/debian/',
108 'architecture' => 'x86_64',
113 is_expected.to contain_apt__setting('list-my_source').with_content(%r{# my_source\ndeb \[arch=x86_64\] http://debian.mirror.iweb.ca/debian/ wheezy main\n})
117 context 'ensure => absent' do
120 os: { family: 'Debian', name: 'Debian', release: { major: '7', full: '7.0' } },
122 lsbdistcodename: 'wheezy',
124 puppetversion: Puppet.version,
129 'ensure' => 'absent',
134 is_expected.to contain_apt__setting('list-my_source').with('ensure' => 'absent')
138 describe 'validation' do
139 context 'no release' do
142 os: { family: 'Debian', name: 'Debian', release: { major: '7', full: '7.0' } },
145 puppetversion: Puppet.version,
150 is_expected.to raise_error(Puppet::Error, %r{lsbdistcodename fact not available: release parameter required})