@@ -11,33 +11,39 @@ 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' } } }
14
+ let ( :certdata ) { { 'certname' => 'primary' , 'extensions' => { '1.3.6.1.4.1.34380.1.1.9813' => 'A' } , 'dns-alt-names' => [ ] } }
15
+ let ( :cfg ) { { 'params' => { 'primary_host' => 'primary' } } }
15
16
16
- it 'runs successfully when the primary doesn\'t have alt-names' do
17
+ it 'runs successfully when the primary does not have alt-names' do
17
18
allow_standard_non_returning_calls
18
- expect_task ( 'peadm::cert_data' ) . always_return ( certdata )
19
+ expect_task ( 'peadm::get_peadm_config' ) . always_return ( cfg )
20
+ expect_task ( 'peadm::cert_data' ) . always_return ( certdata ) . be_called_times ( 3 )
21
+ expect_task ( 'package' ) . always_return ( { 'status' => 'uninstalled' } )
19
22
expect_task ( 'peadm::agent_install' )
20
23
. with_params ( { 'server' => 'primary' ,
21
24
'install_flags' => [
25
+ 'main:dns_alt_names=replica' ,
22
26
'--puppet-service-ensure' , 'stopped' ,
23
- 'main:certname=replica' ,
24
- 'main:dns_alt_names=replica'
27
+ 'main:certname=replica'
25
28
] } )
26
29
30
+ expect_out_message . with_params ( 'Classification to be updated using the following hash...' )
27
31
expect ( run_plan ( 'peadm::add_replica' , params ) ) . to be_ok
28
32
end
29
33
30
34
it 'runs successfully when the primary has alt-names' do
31
35
allow_standard_non_returning_calls
32
- expect_task ( 'peadm::cert_data' ) . always_return ( certdata . merge ( { 'dns-alt-names' => [ 'primary' , 'alt' ] } ) )
36
+ expect_task ( 'peadm::get_peadm_config' ) . always_return ( cfg )
37
+ expect_task ( 'peadm::cert_data' ) . always_return ( certdata . merge ( { 'dns-alt-names' => [ 'primary' , 'alt' ] } ) ) . be_called_times ( 3 )
38
+ expect_task ( 'package' ) . always_return ( { 'status' => 'uninstalled' } )
33
39
expect_task ( 'peadm::agent_install' )
34
40
. with_params ( { 'server' => 'primary' ,
35
41
'install_flags' => [
42
+ 'main:dns_alt_names=replica,alt' ,
36
43
'--puppet-service-ensure' , 'stopped' ,
37
- 'main:certname=replica' ,
38
- 'main:dns_alt_names=replica,alt'
44
+ 'main:certname=replica'
39
45
] } )
40
-
46
+ expect_out_message . with_params ( 'Classification to be updated using the following hash...' )
41
47
expect ( run_plan ( 'peadm::add_replica' , params ) ) . to be_ok
42
48
end
43
49
end
0 commit comments