Skip to content

Commit 6045313

Browse files
committed
Add tests for setting SCL package version
Move SCL checks to the EL6/7 contexts as EL5 is neither tested against nor does it support SCL repositories.
1 parent 7eae51b commit 6045313

1 file changed

Lines changed: 54 additions & 18 deletions

File tree

spec/classes/python_spec.rb

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
end
130130
end
131131
end
132-
when 'RedHat'
132+
when 'RedHat', 'CentOS'
133133
case facts[:os]['release']['major']
134134
when '5'
135135
# written for RHEL 5
@@ -204,23 +204,6 @@
204204
}
205205
end
206206

207-
context 'scl' do
208-
describe 'with manage_scl' do
209-
context 'true' do
210-
let(:params) { { provider: 'scl', manage_scl: true } }
211-
212-
it { is_expected.to contain_package('centos-release-scl') }
213-
it { is_expected.to contain_package('scl-utils') }
214-
end
215-
context 'false' do
216-
let(:params) { { provider: 'scl', manage_scl: false } }
217-
218-
it { is_expected.not_to contain_package('centos-release-scl') }
219-
it { is_expected.not_to contain_package('scl-utils') }
220-
end
221-
end
222-
end
223-
224207
# python::provider
225208
context 'default' do
226209
let(:params) { { provider: '' } }
@@ -262,12 +245,65 @@
262245
context 'on a Redhat 6 OS' do
263246
it { is_expected.to contain_class('python::install') }
264247
it { is_expected.to contain_package('pip').with_name('python-pip') }
248+
249+
describe 'with python::provider' do
250+
context 'scl' do
251+
describe 'with version' do
252+
context '3.6 SCL package' do
253+
let(:params) { { version: 'rh-python36' } }
254+
255+
it { is_expected.to compile }
256+
end
257+
end
258+
describe 'with manage_scl' do
259+
context 'true' do
260+
let(:params) { { provider: 'scl', manage_scl: true } }
261+
262+
it { is_expected.to contain_package('centos-release-scl') }
263+
it { is_expected.to contain_package('scl-utils') }
264+
end
265+
context 'false' do
266+
let(:params) { { provider: 'scl', manage_scl: false } }
267+
268+
it { is_expected.not_to contain_package('centos-release-scl') }
269+
it { is_expected.not_to contain_package('scl-utils') }
270+
end
271+
end
272+
end
273+
end
265274
end
275+
266276
when '7'
267277

268278
context 'on a Redhat 7 OS' do
269279
it { is_expected.to contain_class('python::install') }
270280
it { is_expected.to contain_package('pip').with_name('python2-pip') }
281+
282+
describe 'with python::provider' do
283+
context 'scl' do
284+
describe 'with version' do
285+
context '3.6 SCL package' do
286+
let(:params) { { version: 'rh-python36' } }
287+
288+
it { is_expected.to compile }
289+
end
290+
end
291+
describe 'with manage_scl' do
292+
context 'true' do
293+
let(:params) { { provider: 'scl', manage_scl: true } }
294+
295+
it { is_expected.to contain_package('centos-release-scl') }
296+
it { is_expected.to contain_package('scl-utils') }
297+
end
298+
context 'false' do
299+
let(:params) { { provider: 'scl', manage_scl: false } }
300+
301+
it { is_expected.not_to contain_package('centos-release-scl') }
302+
it { is_expected.not_to contain_package('scl-utils') }
303+
end
304+
end
305+
end
306+
end
271307
end
272308
end
273309
end

0 commit comments

Comments
 (0)