@@ -11,6 +11,7 @@ def allow_standard_non_returning_calls
11
11
end
12
12
13
13
describe 'basic functionality' do
14
+ let ( :code_manager_enabled ) { { 'code_manager_enabled' => true } }
14
15
let ( :params ) { { 'primary_host' => 'primary' , 'replica_host' => 'replica' } }
15
16
let ( :cfg ) { { 'params' => { 'primary_host' => 'primary' } } }
16
17
let ( :certdata ) do
@@ -30,6 +31,7 @@ def allow_standard_non_returning_calls
30
31
31
32
it 'runs successfully when the primary does not have alt-names' do
32
33
allow_standard_non_returning_calls
34
+ expect_task ( 'peadm::code_manager_enabled' ) . always_return ( code_manager_enabled )
33
35
expect_task ( 'peadm::get_peadm_config' ) . always_return ( cfg )
34
36
expect_task ( 'peadm::cert_data' ) . always_return ( certdata ) . be_called_times ( 4 )
35
37
expect_task ( 'peadm::cert_valid_status' ) . always_return ( certstatus )
@@ -50,6 +52,7 @@ def allow_standard_non_returning_calls
50
52
51
53
it 'runs successfully when the primary has alt-names' do
52
54
allow_standard_non_returning_calls
55
+ expect_task ( 'peadm::code_manager_enabled' ) . always_return ( code_manager_enabled )
53
56
expect_task ( 'peadm::get_peadm_config' ) . always_return ( cfg )
54
57
expect_task ( 'peadm::cert_data' ) . always_return ( certdata . merge ( { 'dns-alt-names' => [ 'primary' , 'alt' ] } ) ) . be_called_times ( 4 )
55
58
expect_task ( 'peadm::cert_valid_status' ) . always_return ( certstatus )
@@ -67,5 +70,14 @@ def allow_standard_non_returning_calls
67
70
expect_out_verbose . with_params ( 'Updating classification to...' )
68
71
expect ( run_plan ( 'peadm::add_replica' , params ) ) . to be_ok
69
72
end
73
+
74
+ it 'fails when code manager not enabled' do
75
+ allow_standard_non_returning_calls
76
+ expect_task ( 'peadm::code_manager_enabled' ) . always_return ( { 'code_manager_enabled' => false } )
77
+
78
+ result = run_plan ( 'peadm::add_replica' , params )
79
+ expect ( result ) . not_to be_ok
80
+ expect ( result . value . msg ) . to match ( %r{Code Manager must be enabled} )
81
+ end
70
82
end
71
83
end
0 commit comments