@@ -367,23 +367,14 @@ def test_check_node_status(self, mock_run, mock_error):
367367 ])
368368 mock_error .assert_not_called ()
369369
370- @mock .patch ('crmsh.sh.ShellUtils.get_stdout_stderr' )
371- def test_online_nodes_empty (self , mock_run ):
372- mock_run .return_value = (0 , "data" , None )
373- res = utils .online_nodes ()
374- self .assertEqual (res , [])
375- mock_run .assert_called_once_with ("crm_mon -1" )
376-
377- @mock .patch ('crmsh.sh.ShellUtils.get_stdout_stderr' )
378- def test_online_nodes (self , mock_run ):
379- output = """
380- Node List:
381- * Online: [ 15sp2-1 15sp2-2 ]
382- """
383- mock_run .return_value = (0 , output , None )
370+ @mock .patch ('crmsh.xmlutil.CrmMonXmlParser' )
371+ def test_online_nodes (self , mock_crmmon_parser ):
372+ mock_inst = mock .Mock ()
373+ mock_crmmon_parser .return_value = mock_inst
374+ mock_inst .get_node_list .return_value = ["node1" , "node2" ]
384375 res = utils .online_nodes ()
385- self .assertEqual (res , ["15sp2-1 " , "15sp2-2 " ])
386- mock_run . assert_called_once_with ("crm_mon -1" )
376+ self .assertEqual (res , ["node1 " , "node2 " ])
377+ mock_inst . get_node_list . assert_called_once_with (online = True , node_type = 'member' )
387378
388379 @mock .patch ('crmsh.crash_test.utils.online_nodes' )
389380 def test_peer_node_list_empty (self , mock_online ):
0 commit comments