Skip to content

Commit

Permalink
Merge pull request aws#96 in VFS/bamboos from bugfix/VFS-1753-fix-ret…
Browse files Browse the repository at this point in the history
…urn-code-from-ct_run to develop

# By Jakub Kudzia
# Via Jakub Kudzia
* commit '673f5fad04d12da2441217737e5eda906c96266c':
  VFS-1753 move functions checking is tests were skipped to separate modules
  VFS-1753 fix problems with xml report name
  VFS-1753 checking if tests were skipped in test_run.py
  VFS-1753 return code 0 from tests if test weren't skipped
  • Loading branch information
michalrw committed Mar 16, 2016
2 parents 4b60555 + 673f5fa commit 86d059f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docker/ct_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
import shutil
import sys
import time
from test_run_utils import skipped_test_exists

sys.path.insert(0, 'bamboos/docker')
from environment import docker


parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='Run Common Tests.')
Expand Down Expand Up @@ -251,4 +253,7 @@
os.remove(file)
shutil.move(file + '.bak', file)

if ret != 0 and not skipped_test_exists("test_distributed/logs/*/surefire.xml"):
ret = 0

sys.exit(ret)
7 changes: 6 additions & 1 deletion docker/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
import os
import platform
import sys

from test_run_utils import skipped_test_exists
from environment import docker

script_dir = os.path.dirname(os.path.abspath(__file__))


parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description='Run Common Tests.')
Expand Down Expand Up @@ -74,4 +75,8 @@
('/var/run/docker.sock', 'rw')],
image=args.image,
command=['python', '-c', command])

if ret != 0 and not skipped_test_exists(args.report_path):
ret = 0

sys.exit(ret)
21 changes: 21 additions & 0 deletions docker/test_run_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Author: Jakub Kudzia
Copyright (C) 2015 ACK CYFRONET AGH
This software is released under the MIT license cited in 'LICENSE.txt'
This module contains util functions used in ct_run.py and test_run.py
"""

import glob
import xml.etree.ElementTree as ElementTree


def skipped_test_exists(junit_report_path):
reports = glob.glob(junit_report_path)
# if there are many reports, check only the last one
reports.sort()
tree = ElementTree.parse(reports[-1])
testsuites = tree.getroot()
for testsuite in testsuites:
if testsuite.attrib['skipped'] != '0':
return True
return False

0 comments on commit 86d059f

Please sign in to comment.