forked from theforeman/puppet-foreman
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforeman_install_spec.rb
More file actions
193 lines (167 loc) · 5.76 KB
/
foreman_install_spec.rb
File metadata and controls
193 lines (167 loc) · 5.76 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
require 'spec_helper'
describe 'foreman::install' do
on_supported_os.each do |os, facts|
next if only_test_os() and not only_test_os.include?(os)
next if exclude_test_os() and exclude_test_os.include?(os)
context "on #{os}" do
let :facts do
facts.merge({
:concat_basedir => '/tmp',
})
end
describe 'without parameters' do
let :pre_condition do
"class {'foreman':}"
end
case facts[:osfamily]
when 'RedHat'
configure_scl_repo = (facts[:operatingsystem] != 'RedHat' and facts[:operatingsystem] != 'Fedora')
it { should contain_foreman__repos('foreman') }
it { should contain_class('foreman::repos::extra').with({
:configure_scl_repo => configure_scl_repo,
:configure_epel_repo => facts[:operatingsystem] != 'Fedora',
:configure_brightbox_repo => false,
})}
it { should contain_package('foreman-postgresql').with_ensure('present') }
it { should contain_package('foreman-postgresql') }
it { should contain_package('foreman-postgresql') }
if facts[:operatingsystem] != 'Fedora'
it { should contain_package('tfm-rubygem-passenger-native') }
end
when 'Debian'
configure_brightbox_repo = os == 'ubuntu-12-x86_64'
it { should contain_foreman__repos('foreman') }
it { should contain_class('foreman::repos::extra').with({
:configure_scl_repo => false,
:configure_epel_repo => false,
:configure_brightbox_repo => configure_brightbox_repo,
})}
it { should contain_package('foreman-postgresql').with_ensure('present') }
it { should contain_package('foreman-postgresql') }
it { should contain_package('foreman-postgresql') }
if configure_brightbox_repo
it { should contain_package('passenger-common1.9.1') }
end
end
end
describe 'with version' do
let :pre_condition do
"class {'foreman':
version => 'latest',
}"
end
it { should contain_foreman__repos('foreman') }
it { should contain_package('foreman-postgresql').with_ensure('latest') }
it { should contain_package('foreman-postgresql') }
it { should contain_package('foreman-postgresql') }
end
describe 'with custom repo' do
let :pre_condition do
"class {'foreman':
custom_repo => true,
}"
end
it { should_not contain_foreman__repos('foreman') }
it { should contain_package('foreman-postgresql') }
end
describe 'with sqlite' do
let :pre_condition do
"class {'foreman':
db_type => 'sqlite',
}"
end
case facts[:osfamily]
when 'RedHat'
it { should contain_package('foreman-sqlite') }
it { should contain_package('foreman-sqlite') }
when 'Debian'
it { should contain_package('foreman-sqlite3') }
it { should contain_package('foreman-sqlite3') }
end
end
describe 'with postgresql' do
let :pre_condition do
"class {'foreman':
db_type => 'postgresql',
}"
end
it { should contain_package('foreman-postgresql') }
it { should contain_package('foreman-postgresql') }
end
describe 'with mysql' do
let :pre_condition do
"class {'foreman':
db_type => 'mysql',
}"
end
it { should contain_package('foreman-mysql2') }
it { should contain_package('foreman-mysql2') }
end
if facts[:osfamily] == 'RedHat'
context 'with SELinux enabled' do
let :facts do
facts.merge({
:concat_basedir => '/tmp',
:selinux => true,
})
end
describe 'with selinux undef' do
let :pre_condition do
"class {'foreman': }"
end
it { should contain_package('foreman-selinux') }
it { should contain_package('foreman-selinux') }
end
describe 'with selinux false' do
let :pre_condition do
"class {'foreman':
selinux => false,
}"
end
it { should_not contain_package('foreman-selinux') }
end
describe 'with selinux true' do
let :pre_condition do
"class {'foreman':
selinux => true,
}"
end
it { should contain_package('foreman-selinux') }
it { should contain_package('foreman-selinux') }
end
end
context 'with SELinux disabled' do
let :facts do
facts.merge({
:concat_basedir => '/tmp',
:selinux => false,
})
end
describe 'with selinux undef' do
let :pre_condition do
"class {'foreman': }"
end
it { should_not contain_package('foreman-selinux') }
end
describe 'with selinux false' do
let :pre_condition do
"class {'foreman':
selinux => false,
}"
end
it { should_not contain_package('foreman-selinux') }
end
describe 'with selinux true' do
let :pre_condition do
"class {'foreman':
selinux => true,
}"
end
it { should contain_package('foreman-selinux') }
it { should contain_package('foreman-selinux') }
end
end
end
end
end
end