@@ -11,13 +11,23 @@ def allow_standard_non_returning_calls
11
11
12
12
describe 'basic functionality' do
13
13
let ( :params ) { { 'primary_host' => 'primary' , 'replica_host' => 'replica' } }
14
- let ( :certdata ) { { 'certname' => 'primary' , 'extensions' => { '1.3.6.1.4.1.34380.1.1.9813' => 'A' } , 'dns-alt-names' => [ ] } }
14
+ let ( :certdata ) { {
15
+ 'certificate-exists' => true ,
16
+ 'certname' => 'primary' ,
17
+ 'extensions' => { '1.3.6.1.4.1.34380.1.1.9813' => 'A' } ,
18
+ 'dns-alt-names' => [ ]
19
+ } }
20
+ let ( :certstatus ) { {
21
+ 'certificate-status' => 'valid' ,
22
+ 'reason' => 'Expires - 2099-01-01 00:00:00 UTC'
23
+ } }
15
24
let ( :cfg ) { { 'params' => { 'primary_host' => 'primary' } } }
16
25
17
26
it 'runs successfully when the primary does not have alt-names' do
18
27
allow_standard_non_returning_calls
19
28
expect_task ( 'peadm::get_peadm_config' ) . always_return ( cfg )
20
29
expect_task ( 'peadm::cert_data' ) . always_return ( certdata ) . be_called_times ( 4 )
30
+ expect_task ( 'peadm::cert_valid_status' ) . always_return ( certstatus )
21
31
expect_task ( 'package' ) . always_return ( { 'status' => 'uninstalled' } )
22
32
expect_task ( 'peadm::agent_install' )
23
33
. with_params ( { 'server' => 'primary' ,
@@ -26,6 +36,7 @@ def allow_standard_non_returning_calls
26
36
'--puppet-service-ensure' , 'stopped' ,
27
37
'main:certname=replica'
28
38
] } )
39
+ expect_plan ( 'peadm::util::sync_global_hiera' )
29
40
30
41
expect_out_verbose . with_params ( 'Current config is...' )
31
42
expect_out_verbose . with_params ( 'Updating classification to...' )
@@ -36,6 +47,7 @@ def allow_standard_non_returning_calls
36
47
allow_standard_non_returning_calls
37
48
expect_task ( 'peadm::get_peadm_config' ) . always_return ( cfg )
38
49
expect_task ( 'peadm::cert_data' ) . always_return ( certdata . merge ( { 'dns-alt-names' => [ 'primary' , 'alt' ] } ) ) . be_called_times ( 4 )
50
+ expect_task ( 'peadm::cert_valid_status' ) . always_return ( certstatus )
39
51
expect_task ( 'package' ) . always_return ( { 'status' => 'uninstalled' } )
40
52
expect_task ( 'peadm::agent_install' )
41
53
. with_params ( { 'server' => 'primary' ,
@@ -44,6 +56,8 @@ def allow_standard_non_returning_calls
44
56
'--puppet-service-ensure' , 'stopped' ,
45
57
'main:certname=replica'
46
58
] } )
59
+ expect_plan ( 'peadm::util::sync_global_hiera' )
60
+
47
61
expect_out_verbose . with_params ( 'Current config is...' )
48
62
expect_out_verbose . with_params ( 'Updating classification to...' )
49
63
expect ( run_plan ( 'peadm::add_replica' , params ) ) . to be_ok
0 commit comments