@@ -11,13 +11,23 @@ def allow_standard_non_returning_calls
1111
1212 describe 'basic functionality' do
1313 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+ } }
1524 let ( :cfg ) { { 'params' => { 'primary_host' => 'primary' } } }
1625
1726 it 'runs successfully when the primary does not have alt-names' do
1827 allow_standard_non_returning_calls
1928 expect_task ( 'peadm::get_peadm_config' ) . always_return ( cfg )
2029 expect_task ( 'peadm::cert_data' ) . always_return ( certdata ) . be_called_times ( 4 )
30+ expect_task ( 'peadm::cert_valid_status' ) . always_return ( certstatus )
2131 expect_task ( 'package' ) . always_return ( { 'status' => 'uninstalled' } )
2232 expect_task ( 'peadm::agent_install' )
2333 . with_params ( { 'server' => 'primary' ,
@@ -26,6 +36,7 @@ def allow_standard_non_returning_calls
2636 '--puppet-service-ensure' , 'stopped' ,
2737 'main:certname=replica'
2838 ] } )
39+ expect_plan ( 'peadm::util::sync_global_hiera' )
2940
3041 expect_out_verbose . with_params ( 'Current config is...' )
3142 expect_out_verbose . with_params ( 'Updating classification to...' )
@@ -36,6 +47,7 @@ def allow_standard_non_returning_calls
3647 allow_standard_non_returning_calls
3748 expect_task ( 'peadm::get_peadm_config' ) . always_return ( cfg )
3849 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 )
3951 expect_task ( 'package' ) . always_return ( { 'status' => 'uninstalled' } )
4052 expect_task ( 'peadm::agent_install' )
4153 . with_params ( { 'server' => 'primary' ,
@@ -44,6 +56,8 @@ def allow_standard_non_returning_calls
4456 '--puppet-service-ensure' , 'stopped' ,
4557 'main:certname=replica'
4658 ] } )
59+ expect_plan ( 'peadm::util::sync_global_hiera' )
60+
4761 expect_out_verbose . with_params ( 'Current config is...' )
4862 expect_out_verbose . with_params ( 'Updating classification to...' )
4963 expect ( run_plan ( 'peadm::add_replica' , params ) ) . to be_ok
0 commit comments