|
1 | 1 | require 'spec_helper'
|
2 | 2 |
|
3 | 3 | describe 'jenkins', type: :class do
|
4 |
| - # Switching OS Family to prevent duplicate declaration |
5 |
| - let(:facts) do |
6 |
| - { |
7 |
| - osfamily: 'Redhat', |
8 |
| - operatingsystem: 'CentOS', |
9 |
| - operatingsystemrelease: '6.7', |
10 |
| - operatingsystemmajrelease: '6' |
11 |
| - } |
12 |
| - end |
13 |
| - |
14 |
| - context 'repo::el' do |
15 |
| - describe 'default' do |
16 |
| - it { is_expected.to contain_yumrepo('jenkins').with_baseurl('https://pkg.jenkins.io/redhat-stable/') } |
17 |
| - it { is_expected.to contain_yumrepo('jenkins').with_proxy(nil) } |
18 |
| - end |
19 |
| - |
20 |
| - describe 'lts = true' do |
21 |
| - let(:params) { { lts: true } } |
22 |
| - |
23 |
| - it { is_expected.to contain_yumrepo('jenkins').with_baseurl('https://pkg.jenkins.io/redhat-stable/') } |
24 |
| - it { is_expected.to contain_yumrepo('jenkins').with_proxy(nil) } |
25 |
| - end |
26 |
| - |
27 |
| - describe 'lts = false' do |
28 |
| - let(:params) { { lts: false } } |
29 |
| - |
30 |
| - it { is_expected.to contain_yumrepo('jenkins').with_proxy(nil) } |
31 |
| - it { is_expected.to contain_yumrepo('jenkins').with_baseurl('https://pkg.jenkins.io/redhat/') } |
32 |
| - end |
33 |
| - |
34 |
| - describe 'repo_proxy is set' do |
35 |
| - let(:params) { { repo_proxy: 'http://proxy:8080/' } } |
36 |
| - |
37 |
| - it { is_expected.to contain_yumrepo('jenkins').with_proxy('http://proxy:8080/') } |
| 4 | + on_supported_os.each do |os, facts| |
| 5 | + next unless facts[:os]['family'] == 'RedHat' |
| 6 | + |
| 7 | + context "on #{os} " do |
| 8 | + systemd_fact = case facts[:operatingsystemmajrelease] |
| 9 | + when '6' |
| 10 | + { systemd: false } |
| 11 | + else |
| 12 | + { systemd: true } |
| 13 | + end |
| 14 | + let :facts do |
| 15 | + facts.merge(systemd_fact) |
| 16 | + end |
| 17 | + |
| 18 | + context 'repo::el' do |
| 19 | + describe 'default' do |
| 20 | + it { is_expected.to contain_yumrepo('jenkins').with_baseurl('https://pkg.jenkins.io/redhat-stable/') } |
| 21 | + it { is_expected.to contain_yumrepo('jenkins').with_proxy(nil) } |
| 22 | + end |
| 23 | + |
| 24 | + describe 'lts = true' do |
| 25 | + let(:params) { { lts: true } } |
| 26 | + |
| 27 | + it { is_expected.to contain_yumrepo('jenkins').with_baseurl('https://pkg.jenkins.io/redhat-stable/') } |
| 28 | + it { is_expected.to contain_yumrepo('jenkins').with_proxy(nil) } |
| 29 | + end |
| 30 | + |
| 31 | + describe 'lts = false' do |
| 32 | + let(:params) { { lts: false } } |
| 33 | + |
| 34 | + it { is_expected.to contain_yumrepo('jenkins').with_proxy(nil) } |
| 35 | + it { is_expected.to contain_yumrepo('jenkins').with_baseurl('https://pkg.jenkins.io/redhat/') } |
| 36 | + end |
| 37 | + |
| 38 | + describe 'repo_proxy is set' do |
| 39 | + let(:params) { { repo_proxy: 'http://proxy:8080/' } } |
| 40 | + |
| 41 | + it { is_expected.to contain_yumrepo('jenkins').with_proxy('http://proxy:8080/') } |
| 42 | + end |
| 43 | + end |
38 | 44 | end
|
39 | 45 | end
|
40 | 46 | end
|
0 commit comments