forked from theforeman/puppet-foreman_proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforeman_proxy_settings_file_spec.rb
More file actions
75 lines (60 loc) · 2.29 KB
/
foreman_proxy_settings_file_spec.rb
File metadata and controls
75 lines (60 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
require 'spec_helper'
describe 'foreman_proxy::settings_file' do
on_os_under_test.each do |os, facts|
context "on #{os}" do
let(:facts) { facts }
let(:title) { 'test' }
let(:config_path) do
File.join(
['FreeBSD', 'DragonFly'].include?(facts[:osfamily]) ? '/usr/local/etc' : '/etc',
'foreman-proxy', 'settings.d', "#{title}.yml"
)
end
let :pre_condition do
'include foreman_proxy'
end
context 'defaults, module enabled' do
it do
is_expected.to contain_file(config_path).with(
ensure: 'file',
owner: 'root',
group: ['FreeBSD', 'DragonFly'].include?(facts[:osfamily]) ? 'foreman_proxy' : 'foreman-proxy',
mode: '0640',
)
end
it { is_expected.to contain_file(config_path).that_requires('Class[foreman_proxy::install]') }
it { is_expected.to contain_file(config_path).that_notifies('Class[foreman_proxy::service]') }
it 'should set :enabled in config' do
verify_exact_contents(catalogue, config_path, ['---', ':enabled: https'])
end
it { is_expected.not_to contain_foreman_proxy__feature('Test') }
end
context 'with feature' do
let(:params) { { feature: 'Test' } }
it { is_expected.to contain_foreman_proxy__feature('Test') }
end
context 'with listen_on => both' do
let(:params) { { listen_on: 'both' } }
it 'should set :enabled to true in config' do
verify_exact_contents(catalogue, config_path, ['---', ':enabled: true'])
end
end
context 'with listen_on => http' do
let(:params) { { listen_on: 'http' } }
it 'should set :enabled to http in config' do
verify_exact_contents(catalogue, config_path, ['---', ':enabled: http'])
end
end
context 'with enabled => false' do
let(:params) { { enabled: false } }
it 'should set :enabled to false in config' do
verify_exact_contents(catalogue, config_path, ['---', ':enabled: false'])
end
context 'with feature' do
let(:params) { { enabled: false, feature: 'Test' } }
it { is_expected.not_to contain_foreman_proxy__feature('Test') }
end
end
end
end
end