forked from theforeman/puppet-pulp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpulp_consumer_spec.rb
178 lines (158 loc) · 6.93 KB
/
pulp_consumer_spec.rb
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
require 'spec_helper'
describe 'pulp::consumer' do
context 'on RedHat' do
context 'install class without parameters' do
let :facts do
on_supported_os['redhat-7-x86_64']
end
it { should contain_class('pulp::consumer::install') }
it { should contain_class('pulp::consumer::config') }
it { should contain_class('pulp::consumer::params') }
it { should contain_class('pulp::consumer::service') }
it { should contain_package('pulp-consumer-client').with_ensure('installed') }
it { should contain_package('pulp-rpm-consumer-extensions').with_ensure('installed') }
it { should contain_package('pulp-rpm-yumplugins').with_ensure('installed') }
it { should contain_package('pulp-agent').with_ensure('installed') }
it { should contain_package('pulp-rpm-handlers').with_ensure('installed') }
it 'should set consumer.conf file' do
should contain_file('/etc/pulp/consumer/consumer.conf').
with_content(/^\[server\]$/).
with_content(/^host: foo.example.com$/).
with_content(/^port: 443$/).
with_content(/^api_prefix: \/pulp\/api$/).
with_content(/^rsa_pub: \/etc\/pki\/pulp\/consumer\/server\/rsa_pub.key$/).
with_content(/^verify_ssl: true$/).
with_content(/^ca_path: \/etc\/pki\/tls\/certs\/ca-bundle.crt$/).
with_content(/^\[authentication\]$/).
with_content(/^rsa_key: \/etc\/pki\/pulp\/consumer\/rsa.key$/).
with_content(/^\[client\]$/).
with_content(/^role: consumer$/).
with_content(/^\[filesystem\]$/).
with_content(/^extensions_dir: \/usr\/lib\/pulp\/consumer\/extensions$/).
with_content(/^repo_file: \/etc\/yum.repos.d\/pulp.repo$/).
with_content(/^mirror_list_dir: \/etc\/yum.repos.d$/).
with_content(/^gpg_keys_dir: \/etc\/pki\/pulp-gpg-keys$/).
with_content(/^cert_dir: \/etc\/pki\/pulp\/client\/repo$/).
with_content(/^id_cert_dir: \/etc\/pki\/pulp\/consumer\/$/).
with_content(/^id_cert_filename: consumer-cert.pem$/).
with_content(/^\[reboot\]$/).
with_content(/^permit: false$/).
with_content(/^delay: 3$/).
with_content(/^\[logging\]$/).
with_content(/^filename: \~\/.pulp\/consumer.log$/).
with_content(/^call_log_filename: \~\/.pulp\/consumer_server_calls.log$/).
with_content(/^\[output\]$/).
with_content(/^poll_frequency_in_seconds: 1$/).
with_content(/^enable_color: true$/).
with_content(/^wrap_to_terminal: false$/).
with_content(/^wrap_width: 80$/).
with_content(/^\[messaging\]$/).
with_content(/^scheme: tcp$/).
with_content(/^host: foo.example.com$/).
with_content(/^port: 5672$/).
with_content(/^transport: qpid$/).
without_content(/^vhost:/).
with_content(/^\[profile\]$/).
with_content(/^minutes: 240$/).
with_ensure('file')
end
end
context 'install with puppet param' do
let(:params) do {
'enable_puppet' => true,
} end
it { should contain_package('pulp-puppet-consumer-extensions').with_ensure('installed') }
it { should contain_package('pulp-puppet-handlers').with_ensure('installed') }
it 'should set puppet_bind.conf file' do
should contain_file('/etc/pulp/agent/conf.d/puppet_bind.conf').
with_content(/^\[main\]$/).
with_content(/^enabled=1$/).
with_content(/^\[types\]$/).
with_content(/^bind=puppet_distributor$/).
with_content(/^\[puppet_distributor\]$/).
with_content(/^class=pulp_puppet.handlers.puppet.BindHandler$/).
with_ensure('file')
end
it 'should set puppet_module.conf file' do
should contain_file('/etc/pulp/agent/conf.d/puppet_module.conf').
with_content(/^\[main\]$/).
with_content(/^enabled=1$/).
with_content(/^\[types\]$/).
with_content(/^content=puppet_module$/).
with_content(/^\[puppet_module\]$/).
with_content(/^class=pulp_puppet.handlers.puppet.ModuleHandler$/).
with_ensure('file')
end
end
context 'install with nodes param' do
let(:params) do {
'enable_nodes' => true,
} end
it { should contain_package('pulp-nodes-consumer-extensions').with_ensure('installed') }
end
context 'install with rpm param' do
let(:params) do {
'enable_rpm' => true,
} end
it { should contain_package('pulp-rpm-consumer-extensions').with_ensure('installed') }
it { should contain_package('pulp-rpm-yumplugins').with_ensure('installed') }
it { should contain_package('pulp-rpm-handlers').with_ensure('installed') }
it 'should set bind.conf file' do
should contain_file('/etc/pulp/agent/conf.d/bind.conf').
with_content(/^\[main\]$/).
with_content(/^enabled=1$/).
with_content(/^\[types\]$/).
with_content(/^bind=yum_distributor$/).
with_content(/^\[yum_distributor\]$/).
with_content(/^class=pulp_rpm.handlers.bind.RepoHandler$/).
with_ensure('file')
end
it 'should set linux.conf file' do
should contain_file('/etc/pulp/agent/conf.d/linux.conf').
with_content(/^\[main\]$/).
with_content(/^enabled=1$/).
with_content(/^\[types\]$/).
with_content(/^system=Linux$/).
with_content(/^\[Linux\]$/).
with_content(/^class=pulp_rpm.handlers.linux.LinuxHandler$/).
with_ensure('file')
end
it 'should set rpm.conf file' do
should contain_file('/etc/pulp/agent/conf.d/rpm.conf').
with_content(/^\[main\]$/).
with_content(/^enabled=1$/).
with_content(/^\[types\]$/).
with_content(/^content=rpm,package_group$/).
with_content(/^\[rpm\]$/).
with_content(/^class=pulp_rpm.handlers.rpm.PackageHandler$/).
with_content(/^\[package_group\]$/).
with_content(/^class=pulp_rpm.handlers.rpm.GroupHandler$/).
with_ensure('file')
end
end
context 'install with messaging_vhost param' do
let(:params) do {
'messaging_vhost' => 'pulp',
} end
it 'should set vhost in the consumer.conf file' do
should contain_file('/etc/pulp/consumer/consumer.conf').
with_content(/^\[messaging\]$/).
with_content(/^vhost: pulp$/).
with_ensure('file')
end
end
context 'install with params' do
let(:params) do {
'host' => 'pulp.company.net',
'verify_ssl' => false,
} end
it 'should set the default file' do
should contain_file('/etc/pulp/consumer/consumer.conf').
with_content(/^\[server\]$/).
with_content(/^host: pulp.company.net$/).
with_content(/^verify_ssl: false$/).
with_ensure('file')
end
end
end
end