def test_host_crawler(self, *args):
     crawler = HostCrawler(features=['os', 'cpu'], namespace='localhost')
     frames = list(crawler.crawl())
     namespaces = [f.metadata['namespace'] for f in frames]
     assert namespaces == ['localhost']
     features_count = [f.num_features for f in frames]
     assert features_count == [2]
     system_types = [f.metadata['system_type'] for f in frames]
     assert system_types == ['host']
     assert args[0].call_count == 1
示例#2
0
 def test_host_crawler(self, *args):
     crawler = HostCrawler(features=['os', 'cpu'], namespace='localhost')
     frames = list(crawler.crawl())
     namespaces = [f.metadata['namespace'] for f in frames]
     assert namespaces == ['localhost']
     features_count = [f.num_features for f in frames]
     assert features_count == [2]
     system_types = [f.metadata['system_type'] for f in frames]
     assert system_types == ['host']
     assert args[0].call_count == 1
示例#3
0
 def test_failed_host_crawler_with_ignore_failure(self, *args):
     crawler = HostCrawler(features=['cpu', 'os', 'cpu'],
                           namespace='localhost')
     frames = list(crawler.crawl())
     namespaces = sorted([f.metadata['namespace'] for f in frames])
     assert namespaces == sorted(['localhost'])
     features_count = [f.num_features for f in frames]
     assert features_count == [2]
     system_types = [f.metadata['system_type'] for f in frames]
     assert system_types == ['host']
     assert args[0].call_count == 1
 def test_failed_host_crawler_with_ignore_failure(self, *args):
     crawler = HostCrawler(
         features=[
             'cpu',
             'os',
             'cpu'],
         namespace='localhost')
     frames = list(crawler.crawl())
     namespaces = sorted([f.metadata['namespace'] for f in frames])
     assert namespaces == sorted(['localhost'])
     features_count = [f.num_features for f in frames]
     assert features_count == [2]
     system_types = [f.metadata['system_type'] for f in frames]
     assert system_types == ['host']
     assert args[0].call_count == 1
 def test_failed_host_crawler(self, *args):
     crawler = HostCrawler(features=['os', 'cpu'], namespace='localhost')
     with self.assertRaises(OSError):
         frames = list(crawler.crawl(ignore_plugin_exception=False))
     assert args[0].call_count == 1
示例#6
0
 def test_failed_host_crawler(self, *args):
     crawler = HostCrawler(features=['os', 'cpu'], namespace='localhost')
     with self.assertRaises(OSError):
         frames = list(crawler.crawl(ignore_plugin_exception=False))
     assert args[0].call_count == 1