def test_ha_cluster_init_complete(self, mock_corosync, mock_watchdog): ''' Test _ha_cluster_init method ''' mock_cmd_run = MagicMock(return_value=0) mock_get_hostname = MagicMock(return_value='node') mock_interface_ip = MagicMock(return_value='1.0.1.0') with patch.dict( crmshmod.__salt__, { 'cmd.retcode': mock_cmd_run, 'network.get_hostname': mock_get_hostname, 'network.interface_ip': mock_interface_ip }): result = crmshmod._ha_cluster_init('dog', 'eth1', True, '192.168.1.50', True, 'sbd_dev', True) assert result == 0 mock_watchdog.assert_called_once_with('dog') mock_corosync.assert_called_once_with('1.0.1.0', 'node') mock_interface_ip.assert_called_once_with('eth1') mock_cmd_run.assert_called_once_with( '{} -y -i {} -A {} -S -s {} -q'.format( crmshmod.HA_INIT_COMMAND, 'eth1', '192.168.1.50', 'sbd_dev'))
def test_ha_cluster_init_basic(self): ''' Test _ha_cluster_init method ''' mock_cmd_run = MagicMock(return_value=0) with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}): result = crmshmod._ha_cluster_init() assert result == 0 mock_cmd_run.assert_called_once_with( '{command} -y'.format(command=crmshmod.HA_INIT_COMMAND))