10 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '41.04' } },
11 lsbdistrelease: '14.04',
12 lsbdistcodename: 'trusty',
13 operatingsystem: 'Ubuntu',
19 let(:title) { 'ppa:needs/such.substitution/wow+type' }
21 it { is_expected.not_to contain_package('python-software-properties') }
23 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow+type').that_notifies('Class[Apt::Update]').with(environment: [],
24 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
25 unless: '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow_type-trusty.list && /usr/bin/test -f /etc/apt/trusted.gpg.d/needs-such_substitution-wow_type.gpg', # rubocop:disable Metrics/LineLength
27 logoutput: 'on_failure')
31 describe 'Ubuntu 15.10 sources.list filename' do
34 os: { family: 'Debian', name: 'Ubuntu', release: { major: '15', full: '15.10' } },
35 lsbdistrelease: '15.10',
36 lsbdistcodename: 'wily',
37 operatingsystem: 'Ubuntu',
43 let(:title) { 'ppa:user/foo' }
46 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: [],
47 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
48 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-ubuntu-foo-wily.list && /usr/bin/test -f /etc/apt/trusted.gpg.d/user_ubuntu_foo.gpg', # rubocop:disable Metrics/LineLength
50 logoutput: 'on_failure')
54 describe 'package_name => software-properties-common' do
60 package_name: 'software-properties-common',
66 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
67 lsbdistrelease: '14.04',
68 lsbdistcodename: 'trusty',
69 operatingsystem: 'Ubuntu',
75 let(:title) { 'ppa:needs/such.substitution/wow' }
77 it { is_expected.to contain_package('software-properties-common') }
79 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with('environment' => [],
80 '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
81 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list && /usr/bin/test -f /etc/apt/trusted.gpg.d/needs-such_substitution-wow.gpg', # rubocop:disable Metrics/LineLength
83 'logoutput' => 'on_failure')
87 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')
91 describe 'package_manage => false' do
97 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
98 lsbdistrelease: '14.04',
99 lsbdistcodename: 'trusty',
100 operatingsystem: 'Ubuntu',
107 package_manage: false,
111 let(:title) { 'ppa:needs/such.substitution/wow' }
113 it { is_expected.not_to contain_package('python-software-properties') }
115 is_expected.to contain_exec('add-apt-repository-ppa:needs/such.substitution/wow').that_notifies('Class[Apt::Update]').with('environment' => [],
116 '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
117 'unless' => '/usr/bin/test -f /etc/apt/sources.list.d/needs-such_substitution-wow-trusty.list && /usr/bin/test -f /etc/apt/trusted.gpg.d/needs-such_substitution-wow.gpg', # rubocop:disable Metrics/LineLength
119 'logoutput' => 'on_failure')
123 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')
127 describe 'apt included, no proxy' do
128 let :pre_condition do
130 apt::ppa { "ppa:user/foo2": }
135 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
136 lsbdistrelease: '14.04',
137 lsbdistcodename: 'trusty',
138 operatingsystem: 'Ubuntu',
146 package_manage: true,
147 require: 'Apt::Ppa[ppa:user/foo2]',
150 let(:title) { 'ppa:user/foo' }
152 it { is_expected.to compile.with_all_deps }
153 it { is_expected.to contain_package('software-properties-common') }
155 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: [],
156 command: '/usr/bin/add-apt-repository ppa:user/foo || (rm /etc/apt/sources.list.d/user-foo-trusty.list && false)', # rubocop:disable Metrics/LineLength
157 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list && /usr/bin/test -f /etc/apt/trusted.gpg.d/user-foo.gpg', # rubocop:disable Metrics/LineLength
159 logoutput: 'on_failure')
163 describe 'apt included, proxy host' do
164 let :pre_condition do
166 proxy => { "host" => "localhost" },
171 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
172 lsbdistrelease: '14.04',
173 lsbdistcodename: 'trusty',
174 operatingsystem: 'Ubuntu',
182 'package_manage' => true,
185 let(:title) { 'ppa:user/foo' }
187 it { is_expected.to contain_package('software-properties-common') }
189 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: ['http_proxy=http://localhost:8080'],
190 command: '/usr/bin/add-apt-repository ppa:user/foo || (rm /etc/apt/sources.list.d/user-foo-trusty.list && false)', # rubocop:disable Metrics/LineLength
191 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list && /usr/bin/test -f /etc/apt/trusted.gpg.d/user-foo.gpg', # rubocop:disable Metrics/LineLength
193 logoutput: 'on_failure')
197 describe 'apt included, proxy host and port' do
198 let :pre_condition do
200 proxy => { "host" => "localhost", "port" => 8180 },
205 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
206 lsbdistrelease: '14.04',
207 lsbdistcodename: 'trusty',
208 operatingsystem: 'Ubuntu',
216 package_manage: true,
219 let(:title) { 'ppa:user/foo' }
221 it { is_expected.to contain_package('software-properties-common') }
223 is_expected.to contain_exec('add-apt-repository-ppa:user/foo').that_notifies('Class[Apt::Update]').with(environment: ['http_proxy=http://localhost:8180'],
224 command: '/usr/bin/add-apt-repository ppa:user/foo || (rm /etc/apt/sources.list.d/user-foo-trusty.list && false)', # rubocop:disable Metrics/LineLength
225 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list && /usr/bin/test -f /etc/apt/trusted.gpg.d/user-foo.gpg', # rubocop:disable Metrics/LineLength
227 logoutput: 'on_failure')
231 describe 'apt included, proxy host and port and https' do
232 let :pre_condition do
234 proxy => { "host" => "localhost", "port" => 8180, "https" => true },
239 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
240 lsbdistrelease: '14.04',
241 lsbdistcodename: 'trusty',
242 operatingsystem: 'Ubuntu',
250 package_manage: true,
253 let(:title) { 'ppa:user/foo' }
255 it { is_expected.to contain_package('software-properties-common') }
257 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'],
258 command: '/usr/bin/add-apt-repository ppa:user/foo || (rm /etc/apt/sources.list.d/user-foo-trusty.list && false)', # rubocop:disable Metrics/LineLength
259 unless: '/usr/bin/test -f /etc/apt/sources.list.d/user-foo-trusty.list && /usr/bin/test -f /etc/apt/trusted.gpg.d/user-foo.gpg', # rubocop:disable Metrics/LineLength
261 logoutput: 'on_failure')
265 describe 'ensure absent' do
266 let :pre_condition do
271 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
272 lsbdistrelease: '14.04',
273 lsbdistcodename: 'trusty',
274 operatingsystem: 'Ubuntu',
279 let(:title) { 'ppa:user/foo' }
287 is_expected.to contain_file('/etc/apt/sources.list.d/user-foo-trusty.list').that_notifies('Class[Apt::Update]').with(ensure: 'absent')
291 context 'with validation' do
292 describe 'no release' do
295 os: { family: 'Debian', name: 'Ubuntu', release: { major: '14', full: '14.04' } },
296 lsbdistrelease: '14.04',
297 operatingsystem: 'Ubuntu',
300 lsbdistcodeanme: nil,
303 let(:title) { 'ppa:user/foo' }
306 is_expected.to raise_error(Puppet::Error, %r{lsbdistcodename fact not available: release parameter required})
310 describe 'not ubuntu' do
313 os: { family: 'Debian', name: 'Debian', release: { major: '6', full: '6.0.7' } },
314 lsbdistrelease: '6.0.7',
315 lsbdistcodename: 'wheezy',
316 operatingsystem: 'Debian',
321 let(:title) { 'ppa:user/foo' }
324 is_expected.to raise_error(Puppet::Error, %r{not currently supported on Debian})