Beispiel #1
0
 def test_get_counters_no_data_to_return(self, mock_query):
     mock_query.side_effect = pywintypes.error(-2147481643,
                                               "CollectQueryData",
                                               "No data to return.")
     counter_list = [
         ("Memory", None, "Available Bytes"),
         ("Paging File", "*", "% Usage"),
         ("Processor", "*", "% Processor Time"),
         ("Server", None, "Work Item Shortages"),
         ("Server Work Queues", "*", "Queue Length"),
         ("System", None, "Context Switches/sec"),
     ]
     results = win_pdh.get_counters(counter_list)
     assert results == {}
Beispiel #2
0
 def test_get_counters(self):
     counter_list = [
         ('Memory', None, 'Available Bytes'),
         ('Paging File', '*', '% Usage'),
         ('Processor', '*', '% Processor Time'),
         ('Server', None, 'Work Item Shortages'),
         ('Server Work Queues', '*', 'Queue Length'),
         ('System', None, 'Context Switches/sec'),
     ]
     results = win_pdh.get_counters(counter_list)
     expected_counters = [
         '\\Memory\\Available Bytes', '\\Paging File(*)\\% Usage',
         '\\Processor(*)\\% Processor Time',
         '\\Server\\Work Item Shortages',
         '\\Server Work Queues(*)\\Queue Length',
         '\\System\\Context Switches/sec'
     ]
     for item in expected_counters:
         self.assertTrue(item in results)
Beispiel #3
0
 def test_get_counters(self):
     counter_list = [
         ("Memory", None, "Available Bytes"),
         ("Paging File", "*", "% Usage"),
         ("Processor", "*", "% Processor Time"),
         ("Server", None, "Work Item Shortages"),
         ("Server Work Queues", "*", "Queue Length"),
         ("System", None, "Context Switches/sec"),
     ]
     results = win_pdh.get_counters(counter_list)
     expected_counters = [
         "\\Memory\\Available Bytes",
         "\\Paging File(*)\\% Usage",
         "\\Processor(*)\\% Processor Time",
         "\\Server\\Work Item Shortages",
         "\\Server Work Queues(*)\\Queue Length",
         "\\System\\Context Switches/sec",
     ]
     for item in expected_counters:
         self.assertTrue(item in results)