def test_features_crawler_crawl_outcontainer_cpu(self):
     c = DockerContainer(self.container['Id'])
     crawler = FeaturesCrawler(crawl_mode='OUTCONTAINER', container=c)
     for key, feature in crawler.crawl_cpu():
         print key, feature
     cores = len(list(crawler.crawl_cpu()))
     assert cores > 0
Esempio n. 2
0
 def initialize_crawlers(self):
     for _vmID in FeaturesCrawlerTests.vmIDs:
         # follwoing regex match based pid find works,
         # but no need for complexity!
         # Also not grepping for vm name helps when --pid=host is being
         # used to run docker
         # _qemu_pid = self.get_qemu_pid(_vmID[0])
         _vm = (_vmID[4], _vmID[1], _vmID[2], _vmID[3])  # vmID[4]=qemu_pid
         FeaturesCrawlerTests.crawlers.append(
             FeaturesCrawler(crawl_mode='OUTVM', vm=_vm))
 def test_features_crawler_crawl_outcontainer_mem(self):
     c = DockerContainer(self.container['Id'])
     crawler = FeaturesCrawler(crawl_mode='OUTCONTAINER', container=c)
     output = "%s" % list(crawler.crawl_memory())
     assert 'memory_used' in output
 def test_features_crawler_crawl_outcontainer_processes(self):
     c = DockerContainer(self.container['Id'])
     crawler = FeaturesCrawler(crawl_mode='OUTCONTAINER', container=c)
     assert len(list(crawler.crawl_processes())) == 2  # sleep + crawler
 def test_features_crawler_crawl_invm_mem(self):
     crawler = FeaturesCrawler(crawl_mode='INVM')
     cores = len(list(crawler.crawl_memory()))
     assert cores > 0