@@ -11,6 +11,7 @@ def allow_standard_non_returning_calls
1111 end
1212
1313 describe 'basic functionality' do
14+ let ( :code_manager_enabled ) { { 'code_manager_enabled' => true } }
1415 let ( :params ) { { 'primary_host' => 'primary' , 'replica_host' => 'replica' } }
1516 let ( :cfg ) { { 'params' => { 'primary_host' => 'primary' } } }
1617 let ( :certdata ) do
@@ -30,6 +31,7 @@ def allow_standard_non_returning_calls
3031
3132 it 'runs successfully when the primary does not have alt-names' do
3233 allow_standard_non_returning_calls
34+ expect_task ( 'peadm::code_manager_enabled' ) . always_return ( code_manager_enabled )
3335 expect_task ( 'peadm::get_peadm_config' ) . always_return ( cfg )
3436 expect_task ( 'peadm::cert_data' ) . always_return ( certdata ) . be_called_times ( 4 )
3537 expect_task ( 'peadm::cert_valid_status' ) . always_return ( certstatus )
@@ -50,6 +52,7 @@ def allow_standard_non_returning_calls
5052
5153 it 'runs successfully when the primary has alt-names' do
5254 allow_standard_non_returning_calls
55+ expect_task ( 'peadm::code_manager_enabled' ) . always_return ( code_manager_enabled )
5356 expect_task ( 'peadm::get_peadm_config' ) . always_return ( cfg )
5457 expect_task ( 'peadm::cert_data' ) . always_return ( certdata . merge ( { 'dns-alt-names' => [ 'primary' , 'alt' ] } ) ) . be_called_times ( 4 )
5558 expect_task ( 'peadm::cert_valid_status' ) . always_return ( certstatus )
@@ -67,5 +70,14 @@ def allow_standard_non_returning_calls
6770 expect_out_verbose . with_params ( 'Updating classification to...' )
6871 expect ( run_plan ( 'peadm::add_replica' , params ) ) . to be_ok
6972 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
7082 end
7183end
0 commit comments