@@ -811,15 +811,27 @@ def test_cleanup_existing_sbd_resource(self, mock_CrmMonXmlParser, mock_logger_i
811811 call ("Remove sbd resource '%s'" , 'sbd_resource' )
812812 ])
813813
814- @patch ('crmsh.parallax.parallax_call' )
814+ @patch ('logging.Logger.info' )
815+ @patch ('crmsh.sh.cluster_shell' )
816+ def test_cleanup_sbd_configurations (self , mock_cluster_shell , mock_logger_info ):
817+ mock_cluster_shell_inst = Mock ()
818+ mock_cluster_shell .return_value = mock_cluster_shell_inst
819+ mock_cluster_shell_inst .get_stdout_or_raise_error = Mock ()
820+ sbd .cleanup_sbd_configurations ()
821+ mock_cluster_shell_inst .get_stdout_or_raise_error .assert_has_calls ([
822+ call (f"test -f { sbd .SBDManager .SYSCONFIG_SBD } && mv { sbd .SBDManager .SYSCONFIG_SBD } { sbd .SBDManager .SYSCONFIG_SBD } .bak || exit 0" , host = None ),
823+ call (f"test -d { sbd .SBDManager .SBD_SYSTEMD_DELAY_START_DIR } && rm -rf { sbd .SBDManager .SBD_SYSTEMD_DELAY_START_DIR } && systemctl daemon-reload || exit 0" , host = None ),
824+ call (f"test -d { sbd .SBDManager .SBD_SYSTEMD_DELAY_START_DISABLE_DIR } && rm -rf { sbd .SBDManager .SBD_SYSTEMD_DELAY_START_DISABLE_DIR } && systemctl daemon-reload || exit 0" , host = None ),
825+ ])
826+
827+ @patch ('crmsh.sbd.cleanup_sbd_configurations' )
815828 @patch ('crmsh.utils.cleanup_stonith_related_properties' )
816829 @patch ('crmsh.sbd.sh.cluster_shell' )
817- @patch ('crmsh.utils.cluster_run_cmd' )
818830 @patch ('logging.Logger.info' )
819831 @patch ('crmsh.sbd.ServiceManager' )
820832 @patch ('crmsh.utils.list_cluster_nodes' )
821833 @patch ('crmsh.sbd.cleanup_existing_sbd_resource' )
822- def test_purge_sbd_from_cluster (self , mock_cleanup_existing_sbd_resource , mock_list_cluster_nodes , mock_ServiceManager , mock_logger_info , mock_cluster_run_cmd , mock_cluster_shell , mock_cleanup_stonith_related_properties , mock_parallax_call ):
834+ def test_purge_sbd_from_cluster (self , mock_cleanup_existing_sbd_resource , mock_list_cluster_nodes , mock_ServiceManager , mock_logger_info , mock_cluster_shell , mock_cleanup_stonith_related_properties , mock_rm_sbd_configuration_files ):
823835 mock_list_cluster_nodes .return_value = ['node1' , 'node2' ]
824836 mock_ServiceManager .return_value .service_is_enabled .side_effect = [True , True ]
825837 stonith_data = """stonith-sbd
@@ -830,6 +842,6 @@ def test_purge_sbd_from_cluster(self, mock_cleanup_existing_sbd_resource, mock_l
830842 mock_logger_info .assert_has_calls ([
831843 call ("Disable %s on node %s" , constants .SBD_SERVICE , 'node1' ),
832844 call ("Disable %s on node %s" , constants .SBD_SERVICE , 'node2' ),
833- call ("Move %s to %s on all nodes" , sbd .SBDManager .SYSCONFIG_SBD , sbd .SBDManager .SYSCONFIG_SBD + '.bak' )
834845 ])
835846 mock_cleanup_stonith_related_properties .assert_called_once ()
847+ mock_rm_sbd_configuration_files .assert_has_calls ([call ("node1" ), call ("node2" )])
0 commit comments