def parse_submission(args): # Extract the submission tmpdir = tempfile.mkdtemp() bugtool = inspector.find_in_tarball(args.filename,'tar.bz2') tar = tarfile.open(args.filename) t = tar.extract(bugtool, tmpdir) tarball_path = "%s/%s" % (tmpdir, bugtool) host = inspector.HostFromTarball(tarball_path) inspector.print_system_info(host, ['bios', 'cpu', 'nic', 'storage']) shutil.rmtree(tmpdir) json = get_json_from_test_run(args.filename) #Check for failures validate_test_run(json) if args.post: print post_json_to_mongodb(json)
def parse_submission(args): # Extract the submission tmpdir = tempfile.mkdtemp() bugtool = inspector.find_in_tarball(args.filename, 'tar.bz2') tar = tarfile.open(args.filename) t = tar.extract(bugtool, tmpdir) tarball_path = "%s/%s" % (tmpdir, bugtool) host = inspector.HostFromTarball(tarball_path) inspector.print_system_info(host, ['bios', 'cpu', 'nic', 'storage']) shutil.rmtree(tmpdir) json = get_json_from_test_run(args.filename) # Check for failures validate_test_run(json) if args.post: print post_json_to_mongodb(json)
def test_print_bios(self, mprint_unit): mhost = mock.MagicMock() options = ['bios'] inspector.print_system_info(mhost, options) self.assertEqual(len(mprint_unit.mock_calls), 1)
def test_print_all(self, mprint_unit): mhost = mock.MagicMock() options = ['bios', 'nic', 'storage', 'gpu', 'cpu'] inspector.print_system_info(mhost, options) # GPU is optionally shown only if devices exist self.assertEqual(len(mprint_unit.mock_calls), 4)