|
9 | 9 | os_facts
|
10 | 10 | end
|
11 | 11 |
|
12 |
| - let :params do |
13 |
| - { |
14 |
| - ensure: true, |
15 |
| - version: '1.0.0', |
16 |
| - service_ensure: 'running', |
17 |
| - service_enabled: true, |
18 |
| - config_ensure: 'file', |
19 |
| - config_path: '/etc/voxpupuli/webhook.yml', |
20 |
| - chatops: { |
21 |
| - enabled: true, |
22 |
| - service: 'slack', |
23 |
| - channel: '#channel', |
24 |
| - user: 'root', |
25 |
| - auth_token: 'ABCDEF123456789', |
26 |
| - server_uri: 'https://webhook.slack.com/endpoint', |
27 |
| - }, |
28 |
| - server: { |
29 |
| - protected: true, |
30 |
| - user: 'puppet', |
31 |
| - password: 'puppet', |
32 |
| - port: 4000, |
33 |
| - tls: { |
| 12 | + context 'with default params' do |
| 13 | + if %w[archlinux-rolling-x86_64 gentoo-2-x86_64].include?(os) |
| 14 | + it { is_expected.not_to compile } |
| 15 | + else |
| 16 | + it { is_expected.to compile.with_all_deps } |
| 17 | + it { is_expected.to contain_class('r10k::webhook::package') } |
| 18 | + it { is_expected.to contain_class('r10k::webhook::service') } |
| 19 | + it { is_expected.to contain_class('r10k::webhook::config') } |
| 20 | + it { is_expected.to contain_package('webhook-go').with_ensure('present') } |
| 21 | + it { is_expected.to contain_service('webhook-go').with_ensure('running') } |
| 22 | + end |
| 23 | + end |
| 24 | + |
| 25 | + context 'with params' do |
| 26 | + let :params do |
| 27 | + { |
| 28 | + ensure: true, |
| 29 | + version: '1.0.0', |
| 30 | + service_ensure: 'running', |
| 31 | + service_enabled: true, |
| 32 | + config_ensure: 'file', |
| 33 | + config_path: '/etc/voxpupuli/webhook.yml', |
| 34 | + chatops: { |
34 | 35 | enabled: true,
|
35 |
| - certificate: '/path/to/cert', |
36 |
| - key: '/path/to/key', |
| 36 | + service: 'slack', |
| 37 | + channel: '#channel', |
| 38 | + user: 'root', |
| 39 | + auth_token: 'ABCDEF123456789', |
| 40 | + server_uri: 'https://webhook.slack.com/endpoint', |
| 41 | + }, |
| 42 | + server: { |
| 43 | + protected: true, |
| 44 | + user: 'puppet', |
| 45 | + password: 'puppet', |
| 46 | + port: 4000, |
| 47 | + tls: { |
| 48 | + enabled: true, |
| 49 | + certificate: '/path/to/cert', |
| 50 | + key: '/path/to/key', |
| 51 | + }, |
37 | 52 | },
|
38 |
| - }, |
39 |
| - r10k: { |
40 |
| - command_path: '/opt/puppetlabs/puppet/bin/r10k', |
41 |
| - config_path: '/etc/puppetlabs/r10k/r10k.yaml', |
42 |
| - default_branch: 'production', |
43 |
| - allow_uppercase: false, |
44 |
| - verbose: true, |
45 |
| - deploy_modules: true, |
46 |
| - generate_types: true, |
| 53 | + r10k: { |
| 54 | + command_path: '/opt/puppetlabs/puppet/bin/r10k', |
| 55 | + config_path: '/etc/puppetlabs/r10k/r10k.yaml', |
| 56 | + default_branch: 'production', |
| 57 | + allow_uppercase: false, |
| 58 | + verbose: true, |
| 59 | + deploy_modules: true, |
| 60 | + generate_types: true, |
| 61 | + } |
47 | 62 | }
|
48 |
| - } |
49 |
| - end |
| 63 | + end |
50 | 64 |
|
51 |
| - content = '--- |
| 65 | + content = '--- |
52 | 66 | server:
|
53 | 67 | protected: true
|
54 | 68 | user: puppet
|
|
74 | 88 | deploy_modules: true
|
75 | 89 | generate_types: true
|
76 | 90 | '
|
77 |
| - context 'with default install_method' do |
78 |
| - if %w[archlinux-rolling-x86_64 gentoo-2-x86_64].include?(os) |
79 |
| - it { is_expected.not_to compile } |
80 |
| - else |
81 |
| - it { is_expected.to compile.with_all_deps } |
82 |
| - it { is_expected.to contain_class('r10k::webhook::package') } |
83 |
| - it { is_expected.to contain_class('r10k::webhook::service') } |
84 |
| - it { is_expected.to contain_class('r10k::webhook::config') } |
85 |
| - it { is_expected.to contain_package('webhook-go').with_ensure('present') } |
86 |
| - it { is_expected.to contain_service('webhook-go').with_ensure('running') } |
87 |
| - it { is_expected.to contain_file('webhook.yml').with_content(content) } |
| 91 | + context 'with default install_method' do |
| 92 | + if %w[archlinux-rolling-x86_64 gentoo-2-x86_64].include?(os) |
| 93 | + it { is_expected.not_to compile } |
| 94 | + else |
| 95 | + it { is_expected.to compile.with_all_deps } |
| 96 | + it { is_expected.to contain_class('r10k::webhook::package') } |
| 97 | + it { is_expected.to contain_class('r10k::webhook::service') } |
| 98 | + it { is_expected.to contain_class('r10k::webhook::config') } |
| 99 | + it { is_expected.to contain_package('webhook-go').with_ensure('present') } |
| 100 | + it { is_expected.to contain_service('webhook-go').with_ensure('running') } |
| 101 | + it { is_expected.to contain_file('webhook.yml').with_content(content) } |
88 | 102 |
|
89 |
| - if os_facts[:os]['family'] == 'RedHat' |
90 |
| - it { is_expected.to contain_file('/tmp/webhook-go.rpm') } |
91 |
| - it { is_expected.not_to contain_file('/tmp/webhook-go.deb') } |
92 |
| - elsif os_facts[:os]['family'] == 'Debian' |
93 |
| - it { is_expected.not_to contain_file('/tmp/webhook-go.rpm') } |
94 |
| - it { is_expected.to contain_file('/tmp/webhook-go.deb') } |
| 103 | + if os_facts[:os]['family'] == 'RedHat' |
| 104 | + it { is_expected.to contain_file('/tmp/webhook-go.rpm') } |
| 105 | + it { is_expected.not_to contain_file('/tmp/webhook-go.deb') } |
| 106 | + elsif os_facts[:os]['family'] == 'Debian' |
| 107 | + it { is_expected.not_to contain_file('/tmp/webhook-go.rpm') } |
| 108 | + it { is_expected.to contain_file('/tmp/webhook-go.deb') } |
| 109 | + end |
95 | 110 | end
|
96 | 111 | end
|
97 |
| - end |
98 | 112 |
|
99 |
| - context 'with install_method = none' do |
100 |
| - let :params do |
101 |
| - super().merge({ install_method: 'none' }) |
102 |
| - end |
| 113 | + context 'with install_method = none' do |
| 114 | + let :params do |
| 115 | + super().merge({ install_method: 'none' }) |
| 116 | + end |
103 | 117 |
|
104 |
| - it { is_expected.to compile.with_all_deps } |
| 118 | + it { is_expected.to compile.with_all_deps } |
| 119 | + end |
105 | 120 | end
|
106 | 121 | end
|
107 | 122 | end
|
|
0 commit comments