def test_failed_vms_crawler_with_ignore_failure(self, *args):
     crawler = VirtualMachinesCrawler(features=['cpu', 'os', 'cpu'])
     frames = list(crawler.crawl())  # defaults to ignore_plugin_exception
     namespaces = sorted([f.metadata['namespace'] for f in frames])
     assert namespaces == sorted(['aaa', 'errorid', 'ccc'])
     features_count = sorted([f.num_features for f in frames])
     assert features_count == sorted([3, 2, 3])
     system_types = [f.metadata['system_type'] for f in frames]
     assert system_types == ['vm', 'vm', 'vm']
     assert args[0].call_count == 1
     assert args[1].call_count == 1
 def test_vms_crawler(self, *args):
     crawler = VirtualMachinesCrawler(features=['os'], user_list=['abcd'])
     frames = list(crawler.crawl())
     namespaces = sorted([f.metadata['namespace'] for f in frames])
     assert namespaces == sorted(['aaa', 'bbb', 'ccc'])
     features_count = sorted([f.num_features for f in frames])
     assert features_count == sorted([2, 2, 2])
     system_types = sorted([f.metadata['system_type'] for f in frames])
     assert system_types == sorted(['vm', 'vm', 'vm'])
     assert args[0].call_count == 1
     assert args[1].call_count == 1
示例#3
0
 def test_failed_vms_crawler_with_ignore_failure(self, *args):
     crawler = VirtualMachinesCrawler(features=['cpu', 'os', 'cpu'])
     frames = list(crawler.crawl())  # defaults to ignore_plugin_exception
     namespaces = sorted([f.metadata['namespace'] for f in frames])
     assert namespaces == sorted(['aaa', 'errorid', 'ccc'])
     features_count = sorted([f.num_features for f in frames])
     assert features_count == sorted([3, 2, 3])
     system_types = [f.metadata['system_type'] for f in frames]
     assert system_types == ['vm', 'vm', 'vm']
     assert args[0].call_count == 1
     assert args[1].call_count == 1
示例#4
0
 def test_vms_crawler(self, *args):
     crawler = VirtualMachinesCrawler(features=['os'], user_list=['abcd'])
     frames = list(crawler.crawl())
     namespaces = sorted([f.metadata['namespace'] for f in frames])
     assert namespaces == sorted(['aaa', 'bbb', 'ccc'])
     features_count = sorted([f.num_features for f in frames])
     assert features_count == sorted([2, 2, 2])
     system_types = sorted([f.metadata['system_type'] for f in frames])
     assert system_types == sorted(['vm', 'vm', 'vm'])
     assert args[0].call_count == 1
     assert args[1].call_count == 1
 def testCrawlVM1(self):
     vm_list = [
         'vm2,4.0.3.x86_64,vanilla,x86_64',
         'vm3,3.2.0-101-generic_3.2.0-101.x86_64,ubuntu,x86_64',
         'vm4,3.13.0-24-generic_3.13.0-24.x86_64,ubuntu,x86_64'
     ]
     crawler = VirtualMachinesCrawler(
         features=['os', 'memory', 'interface', 'process'],
         user_list=vm_list)
     frames = list(crawler.crawl())
     output = str(frames[0])
     print output  # only printed if the test fails
     assert 'interface-lo' in output
     assert 'if_octets_tx=' in output
     assert 'memory' in output
     assert 'memory_buffered=' in output
 def testCrawlVM1(self):
     vm_list = [
         'vm2,4.0.3.x86_64,vanilla,x86_64',
         'vm3,3.2.0-101-generic_3.2.0-101.x86_64,ubuntu,x86_64',
         'vm4,3.13.0-24-generic_3.13.0-24.x86_64,ubuntu,x86_64']
     crawler = VirtualMachinesCrawler(
         features=[
             'os',
             'memory',
             'interface',
             'process'],
         user_list=vm_list)
     frames = list(crawler.crawl())
     output = str(frames[0])
     print output  # only printed if the test fails
     assert 'interface-lo' in output
     assert 'if_octets_tx=' in output
     assert 'memory' in output
     assert 'memory_buffered=' in output
 def test_failed_vms_crawler(self, *args):
     crawler = VirtualMachinesCrawler(features=['os'])
     with self.assertRaises(OSError):
         frames = list(crawler.crawl(ignore_plugin_exception=False))
     assert args[0].call_count == 1
     assert args[1].call_count == 1
示例#8
0
 def test_failed_vms_crawler(self, *args):
     crawler = VirtualMachinesCrawler(features=['os'])
     with self.assertRaises(OSError):
         frames = list(crawler.crawl(ignore_plugin_exception=False))
     assert args[0].call_count == 1
     assert args[1].call_count == 1