aboutsummaryrefslogtreecommitdiffstats
path: root/ci/run_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'ci/run_tests.py')
-rw-r--r--ci/run_tests.py36
1 files changed, 32 insertions, 4 deletions
diff --git a/ci/run_tests.py b/ci/run_tests.py
index 95bc9802..10621440 100644
--- a/ci/run_tests.py
+++ b/ci/run_tests.py
@@ -10,11 +10,13 @@
import argparse
import os
+import subprocess
import sys
import functest.ci.tier_builder as tb
-import functest.utils.functest_logger as ft_logger
import functest.utils.clean_openstack as clean_os
+import functest.utils.functest_logger as ft_logger
+import functest.utils.openstack_utils as os_utils
""" arguments """
@@ -50,6 +52,15 @@ def print_separator(str, count=45):
logger.info("%s" % line)
+def source_rc_file():
+ rc_file = os.getenv('creds')
+ if not os.path.isfile(rc_file):
+ logger.error("RC file %s does not exist..." % rc_file)
+ sys.exit(1)
+ logger.info("Sourcing the OpenStack RC file...")
+ os_utils.source_credentials(rc_file)
+
+
def cleanup():
print_separator("+")
logger.info("Cleaning OpenStack resources...")
@@ -70,14 +81,26 @@ def run_test(test):
flags += " -r"
cmd = ("%s%s" % (EXEC_SCRIPT, flags))
- logger.debug("Executing command %s" % cmd)
-
+ logger.debug("Executing command '%s'" % cmd)
print_separator("")
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
+
+ while p.poll() is None:
+ line = p.stdout.readline().rstrip()
+ logger.debug(line)
+
+ if p != 0:
+ logger.error("The command '%s' failed. Cleaning and exiting." % cmd)
+ if CLEAN_FLAG:
+ cleanup()
+ sys.exit(1)
+
if CLEAN_FLAG:
cleanup()
+
def run_tier(tier):
print_separator("#")
logger.info("Running tier '%s'" % tier.get_name())
@@ -88,7 +111,11 @@ def run_tier(tier):
def run_all(tiers):
- logger.debug("Tiers to be executed:\n\n%s" % tiers)
+ logger.debug("Tiers to be executed:")
+ for tier in tiers.get_tiers():
+ logger.info("\n - %s. %s:\n\t%s"
+ % (tier.get_order(), tier.get_name(), tier.get_tests()))
+
for tier in tiers.get_tiers():
run_tier(tier)
@@ -110,6 +137,7 @@ def main():
REPORT_FLAG = True
if args.test:
+ source_rc_file()
if _tiers.get_tier(args.test):
run_tier(_tiers.get_tier(args.test))