|
223 | 223 | end |
224 | 224 | when 'RedHat', 'CentOS' |
225 | 225 | case facts[:os]['release']['major'] |
226 | | - when '5' |
227 | | - # written for RHEL 5 |
228 | | - context 'on a Redhat OS' do |
229 | | - it { is_expected.to contain_class('python::install') } |
230 | | - # Base debian packages. |
231 | | - it { is_expected.to contain_package('python') } |
232 | | - it { is_expected.to contain_package('python-dev').with_name('python-devel') } |
233 | | - it { is_expected.to contain_package('python-dev').with_alias('python-devel') } |
234 | | - it { is_expected.to contain_package('pip') } |
235 | | - it { is_expected.to contain_package('pip').with_name('python-pip') } |
236 | | - # Basic python packages (from pip) |
237 | | - it { is_expected.to contain_package('virtualenv') } |
238 | | - |
239 | | - describe 'EPEL may be needed on EL' do |
240 | | - context 'default/empty' do |
241 | | - it { is_expected.to contain_class('epel') } |
242 | | - end |
243 | | - end |
244 | | - |
245 | | - describe 'with python::dev' do |
246 | | - context 'true' do |
247 | | - let(:params) { { dev: 'present' } } |
248 | | - |
249 | | - it { is_expected.to contain_package('python-dev').with_ensure('present') } |
250 | | - end |
251 | | - context 'empty/default' do |
252 | | - it { is_expected.to contain_package('python-dev').with_ensure('absent') } |
253 | | - end |
254 | | - end |
255 | | - |
256 | | - describe 'with manage_gunicorn' do |
257 | | - context 'true' do |
258 | | - let(:params) { { manage_gunicorn: true } } |
259 | | - |
260 | | - it { is_expected.to contain_package('gunicorn') } |
261 | | - end |
262 | | - context 'empty args' do |
263 | | - # let(:params) {{ :manage_gunicorn => '' }} |
264 | | - it { is_expected.to contain_package('gunicorn') } |
265 | | - end |
266 | | - context 'false' do |
267 | | - let(:params) { { manage_gunicorn: false } } |
268 | | - |
269 | | - it { is_expected.not_to contain_package('gunicorn') } |
270 | | - end |
271 | | - end |
272 | | - |
273 | | - describe 'with python::provider' do |
274 | | - context 'pip' do |
275 | | - let(:params) { { provider: 'pip' } } |
276 | | - |
277 | | - it { |
278 | | - is_expected.to contain_package('virtualenv').with( |
279 | | - 'provider' => 'pip' |
280 | | - ) |
281 | | - } |
282 | | - it { |
283 | | - is_expected.to contain_package('pip').with( |
284 | | - 'provider' => 'pip' |
285 | | - ) |
286 | | - } |
287 | | - end |
288 | | - |
289 | | - context 'anaconda' do |
290 | | - let(:params) { { provider: 'anaconda', anaconda_install_path: '/opt/test_path' } } |
291 | | - |
292 | | - it { |
293 | | - is_expected.to contain_file('/var/tmp/anaconda_installer.sh') |
294 | | - is_expected.to contain_exec('install_anaconda_python').with_command('/var/tmp/anaconda_installer -b -p /opt/test_path') |
295 | | - is_expected.to contain_exec('install_anaconda_virtualenv').with_command('/opt/test_path/bin/pip install virtualenv') |
296 | | - } |
297 | | - end |
298 | | - |
299 | | - # python::provider |
300 | | - context 'default' do |
301 | | - let(:params) { { provider: '' } } |
302 | | - |
303 | | - it { is_expected.to contain_package('virtualenv') } |
304 | | - it { is_expected.to contain_package('pip') } |
305 | | - |
306 | | - describe 'with python::virtualenv' do |
307 | | - context 'true' do |
308 | | - let(:params) { { provider: '', virtualenv: 'present' } } |
309 | | - |
310 | | - it { is_expected.to contain_package('virtualenv').with_ensure('present') } |
311 | | - end |
312 | | - end |
313 | | - |
314 | | - describe 'with python::virtualenv' do |
315 | | - context 'default/empty' do |
316 | | - let(:params) { { provider: '' } } |
317 | | - |
318 | | - it { is_expected.to contain_package('virtualenv').with_ensure('absent') } |
319 | | - end |
320 | | - end |
321 | | - end |
322 | | - end |
323 | | - |
324 | | - describe 'with python::dev' do |
325 | | - context 'true' do |
326 | | - let(:params) { { dev: 'present' } } |
327 | | - |
328 | | - it { is_expected.to contain_package('python-dev').with_ensure('present') } |
329 | | - end |
330 | | - context 'default/empty' do |
331 | | - it { is_expected.to contain_package('python-dev').with_ensure('absent') } |
332 | | - end |
333 | | - end |
334 | | - end |
335 | | - when '6' |
336 | | - |
337 | | - context 'on a Redhat 6 OS' do |
338 | | - it { is_expected.to contain_class('python::install') } |
339 | | - it { is_expected.to contain_package('pip').with_name('python-pip') } |
340 | | - |
341 | | - describe 'with python::provider' do |
342 | | - context 'scl' do |
343 | | - describe 'with version' do |
344 | | - context '3.6 SCL meta package' do |
345 | | - let(:params) { { version: 'rh-python36' } } |
346 | | - |
347 | | - it { is_expected.to compile.with_all_deps } |
348 | | - end |
349 | | - context '3.6 SCL python package' do |
350 | | - let(:params) { { version: 'rh-python36-python' } } |
351 | | - |
352 | | - it { is_expected.to compile.with_all_deps } |
353 | | - end |
354 | | - end |
355 | | - describe 'with manage_scl' do |
356 | | - context 'true' do |
357 | | - let(:params) { { provider: 'scl', manage_scl: true } } |
358 | | - |
359 | | - it { is_expected.to contain_package('centos-release-scl') } |
360 | | - it { is_expected.to contain_package('scl-utils') } |
361 | | - end |
362 | | - context 'false' do |
363 | | - let(:params) { { provider: 'scl', manage_scl: false } } |
364 | | - |
365 | | - it { is_expected.not_to contain_package('centos-release-scl') } |
366 | | - it { is_expected.not_to contain_package('scl-utils') } |
367 | | - end |
368 | | - end |
369 | | - end |
370 | | - end |
371 | | - end |
372 | | - |
373 | 226 | when '7' |
374 | 227 |
|
375 | 228 | context 'on a Redhat 7 OS' do |
|
0 commit comments