Skip to content

Commit 2419e2e

Browse files
committed
Fix tests for add_compiler
Introduced new things that needed to be mocked to finish successfully
1 parent cb206d6 commit 2419e2e

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

spec/plans/add_compiler_spec.rb

+18-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,24 @@ def allow_standard_non_returning_calls
1919
}
2020
end
2121

22+
let(:cfg) do
23+
{
24+
'params' => {
25+
'primary_host' => 'primary'
26+
},
27+
'role-letter' => {
28+
'server' => {
29+
'A' => 'server_a',
30+
'B' => 'server_b'
31+
}
32+
}
33+
}
34+
end
2235
let(:certdata) { { 'certname' => 'primary', 'extensions' => { '1.3.6.1.4.1.34380.1.1.9813' => 'A' } } }
2336

2437
it 'runs successfully when no alt-names are specified' do
2538
allow_standard_non_returning_calls
39+
expect_task('peadm::get_peadm_config').always_return(cfg)
2640
expect_plan('peadm::modify_certificate').always_return('mock' => 'mock')
2741
expect_task('peadm::agent_install')
2842
.with_params({ 'server' => 'primary',
@@ -33,8 +47,9 @@ def allow_standard_non_returning_calls
3347

3448
# {"install_flags"=>
3549
# ["--puppet-service-ensure", "stopped",
36-
# "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"}
50+
# "extenion_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"}
3751

52+
expect_plan('peadm::util::sync_global_hiera')
3853
expect(run_plan('peadm::add_compiler', params)).to be_ok
3954
end
4055

@@ -45,6 +60,7 @@ def allow_standard_non_returning_calls
4560

4661
it 'runs successfully when alt-names are specified' do
4762
allow_standard_non_returning_calls
63+
expect_task('peadm::get_peadm_config').always_return(cfg)
4864
expect_plan('peadm::modify_certificate').always_return('mock' => 'mock')
4965
expect_task('peadm::agent_install')
5066
.with_params({ 'server' => 'primary',
@@ -53,7 +69,7 @@ def allow_standard_non_returning_calls
5369
'--puppet-service-ensure', 'stopped',
5470
'main:certname=compiler'
5571
] })
56-
72+
expect_plan('peadm::util::sync_global_hiera')
5773
expect(run_plan('peadm::add_compiler', params2)).to be_ok
5874
end
5975
end

0 commit comments

Comments
 (0)