10 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '41.04' } },
11 lsbdistrelease: '14.04',
12 lsbdistcodename: 'trusty',
13 operatingsystem: 'Ubuntu',
16 puppetversion: Puppet.version,
20 let(:title) { 'ppa:needs/such.substitution/wow+type' }
22 it { is_expected.not_to contain_package('python-software-properties') }
24 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow+type').that_notifies('Class[Apt::Update]').with(environment: [],
25 command: '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow+type || rm /etc/apt/sources.list.d/needs-such_substitution-wow_type-trusty.list && false', # rubocop:disable Metrics/LineLength
26 unless: '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow_type-trusty.list', # rubocop:disable Metrics/LineLength
28 logoutput: 'on_failure')
32 describe 'Ubuntu 15.10 sources.list filename' do
35 os: { family: 'Debian', name: 'Ubuntu', release: { major: '15', full: '15.10' } },
36 lsbdistrelease: '15.10',
37 lsbdistcodename: 'wily',
38 operatingsystem: 'Ubuntu',
41 puppetversion: Puppet.version,
45 let(:title) { 'ppa:user/foo' }
48 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: [],
49 command: '/usr/bin/add-apt-repository -y ppa:user/foo || rm /etc/apt/sources.list.d/user-ubuntu-foo-wily.list && false', # rubocop:disable Metrics/LineLength
50 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-ubuntu-foo-wily.list',
52 logoutput: 'on_failure')
56 describe 'package_name => software-properties-common' do
62 package_name: 'software-properties-common',
68 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
69 lsbdistrelease: '14.04',
70 lsbdistcodename: 'trusty',
71 operatingsystem: 'Ubuntu',
74 puppetversion: Puppet.version,
78 let(:title) { 'ppa:needs/such.substitution/wow' }
80 it { is_expected.to contain_package('software-properties-common') }
82 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with('environment' => [],
83 'command' => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow || rm /etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list && false', # rubocop:disable Metrics/LineLength
84 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list', # rubocop:disable Metrics/LineLength
86 'logoutput' => 'on_failure')
90 is_expected.to contain_file('/etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list').that_requires('Exec[add-apt-repository-ppa:needs/such.substitution/wow]').with('ensure' => 'file')
94 describe 'package_manage => false' do
100 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
101 lsbdistrelease: '14.04',
102 lsbdistcodename: 'trusty',
103 operatingsystem: 'Ubuntu',
106 puppetversion: Puppet.version,
111 package_manage: false,
115 let(:title) { 'ppa:needs/such.substitution/wow' }
117 it { is_expected.not_to contain_package('python-software-properties') }
119 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with('environment' => [],
120 'command' => '/usr/bin/add-apt-repository -y ppa:needs/such.substitution/wow || rm /etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list && false', # rubocop:disable Metrics/LineLength
121 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list', # rubocop:disable Metrics/LineLength
123 'logoutput' => 'on_failure')
127 is_expected.to contain_file('/etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list').that_requires('Exec[add-apt-repository-ppa:needs/such.substitution/wow]').with('ensure' => 'file')
131 describe 'apt included, no proxy' do
132 let :pre_condition do
134 apt::ppa { "ppa:user/foo2": }
139 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
140 lsbdistrelease: '14.04',
141 lsbdistcodename: 'trusty',
142 operatingsystem: 'Ubuntu',
145 puppetversion: Puppet.version,
151 package_manage: true,
152 require: 'Apt::Ppa[ppa:user/foo2]',
155 let(:title) { 'ppa:user/foo' }
157 it { is_expected.to compile.with_all_deps }
158 it { is_expected.to contain_package('software-properties-common') }
160 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: [],
161 command: '/usr/bin/add-apt-repository ppa:user/foo || rm /etc/apt/sources.list.d/user-foo-trusty.list && false', # rubocop:disable Metrics/LineLength
162 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
164 logoutput: 'on_failure')
168 describe 'apt included, proxy host' do
169 let :pre_condition do
171 proxy => { "host" => "localhost" },
176 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
177 lsbdistrelease: '14.04',
178 lsbdistcodename: 'trusty',
179 operatingsystem: 'Ubuntu',
182 puppetversion: Puppet.version,
188 'package_manage' => true,
191 let(:title) { 'ppa:user/foo' }
193 it { is_expected.to contain_package('software-properties-common') }
195 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: ['http_proxy=http://localhost:8080'],
196 command: '/usr/bin/add-apt-repository ppa:user/foo || rm /etc/apt/sources.list.d/user-foo-trusty.list && false', # rubocop:disable Metrics/LineLength
197 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
199 logoutput: 'on_failure')
203 describe 'apt included, proxy host and port' do
204 let :pre_condition do
206 proxy => { "host" => "localhost", "port" => 8180 },
211 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
212 lsbdistrelease: '14.04',
213 lsbdistcodename: 'trusty',
214 operatingsystem: 'Ubuntu',
217 puppetversion: Puppet.version,
223 package_manage: true,
226 let(:title) { 'ppa:user/foo' }
228 it { is_expected.to contain_package('software-properties-common') }
230 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: ['http_proxy=http://localhost:8180'],
231 command: '/usr/bin/add-apt-repository ppa:user/foo || rm /etc/apt/sources.list.d/user-foo-trusty.list && false', # rubocop:disable Metrics/LineLength
232 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
234 logoutput: 'on_failure')
238 describe 'apt included, proxy host and port and https' do
239 let :pre_condition do
241 proxy => { "host" => "localhost", "port" => 8180, "https" => true },
246 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
247 lsbdistrelease: '14.04',
248 lsbdistcodename: 'trusty',
249 operatingsystem: 'Ubuntu',
252 puppetversion: Puppet.version,
258 package_manage: true,
261 let(:title) { 'ppa:user/foo' }
263 it { is_expected.to contain_package('software-properties-common') }
265 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: ['http_proxy=http://localhost:8180', 'https_proxy=https://localhost:8180'],
266 command: '/usr/bin/add-apt-repository ppa:user/foo || rm /etc/apt/sources.list.d/user-foo-trusty.list && false', # rubocop:disable Metrics/LineLength
267 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list',
269 logoutput: 'on_failure')
273 describe 'ensure absent' do
274 let :pre_condition do
279 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
280 lsbdistrelease: '14.04',
281 lsbdistcodename: 'trusty',
282 operatingsystem: 'Ubuntu',
285 puppetversion: Puppet.version,
288 let(:title) { 'ppa:user/foo' }
296 is_expected.to contain_file('/etc/apt/sources.list.d/user-foo-trusty.list').that_notifies('Class[Apt::Update]').with(ensure: 'absent')
300 context 'with validation' do
301 describe 'no release' do
304 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
305 lsbdistrelease: '14.04',
306 operatingsystem: 'Ubuntu',
309 lsbdistcodeanme: nil,
310 puppetversion: Puppet.version,
313 let(:title) { 'ppa:user/foo' }
316 is_expected.to raise_error(Puppet::Error, %r{lsbdistcodename fact not available: release parameter required})
320 describe 'not ubuntu' do
323 os: { family: 'Debian', name: 'Debian', release: { major: '6', full: '6.0.7' } },
324 lsbdistrelease: '6.0.7',
325 lsbdistcodename: 'wheezy',
326 operatingsystem: 'Debian',
329 puppetversion: Puppet.version,
332 let(:title) { 'ppa:user/foo' }
335 is_expected.to raise_error(Puppet::Error, %r{not currently supported on Debian})