-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathadd_compiler_spec.rb
61 lines (51 loc) · 2.03 KB
/
add_compiler_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
require 'spec_helper'
describe 'peadm::add_compiler' do
include BoltSpec::Plans
def allow_standard_non_returning_calls
allow_apply
allow_any_task
allow_any_command
end
describe 'basic functionality' do
let(:params) do
{
'primary_host' => 'primary',
'compiler_host' => 'compiler',
'avail_group_letter' => 'A',
'primary_postgresql_host' => 'primary_postgresql',
}
end
let(:certdata) { { 'certname' => 'primary', 'extensions' => { '1.3.6.1.4.1.34380.1.1.9813' => 'A' } } }
it 'runs successfully when no alt-names are specified' do
allow_standard_non_returning_calls
expect_plan('peadm::modify_certificate').always_return('mock' => 'mock')
expect_task('peadm::agent_install')
.with_params({ 'server' => 'primary',
'install_flags' => [
'--puppet-service-ensure', 'stopped',
'main:certname=compiler'
] })
# {"install_flags"=>
# ["--puppet-service-ensure", "stopped",
# "extension_requests:1.3.6.1.4.1.34380.1.3.13=pe_compiler", "extension_requests:1.3.6.1.4.1.34380.1.1.9813=A", "main:certname=compiler"], "server"=>"primary"}
expect(run_plan('peadm::add_compiler', params)).to be_ok
end
context 'with alt-names' do
let(:params2) do
params.merge({ 'dns_alt_names' => 'foo,bar' })
end
it 'runs successfully when alt-names are specified' do
allow_standard_non_returning_calls
expect_plan('peadm::modify_certificate').always_return('mock' => 'mock')
expect_task('peadm::agent_install')
.with_params({ 'server' => 'primary',
'install_flags' => [
'main:dns_alt_names=foo,bar',
'--puppet-service-ensure', 'stopped',
'main:certname=compiler'
] })
expect(run_plan('peadm::add_compiler', params2)).to be_ok
end
end
end
end