import argparse
import os
+import re
import sys
import functest.ci.tier_builder as tb
-import functest.utils.clean_openstack as clean_os
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
+import functest.utils.openstack_clean as os_clean
+import functest.utils.openstack_snapshot as os_snapshot
import functest.utils.openstack_utils as os_utils
-""" arguments """
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--test", dest="test", action='store',
help="Test case or tier (group of tests) to be executed. "
os_utils.source_credentials(rc_file)
+def generate_os_snapshot():
+ os_snapshot.main()
+
+
def cleanup():
- clean_os.main()
+ os_clean.main()
def run_test(test):
logger.info("Running test case '%s'..." % test_name)
print_separator("=")
logger.debug("\n%s" % test)
+
+ if CLEAN_FLAG:
+ generate_os_snapshot()
+
flags = (" -t %s" % (test_name))
if REPORT_FLAG:
flags += " -r"
def run_all(tiers):
summary = ""
+ BUILD_TAG = os.getenv('BUILD_TAG')
+ if BUILD_TAG is not None and re.search("daily", BUILD_TAG) is not None:
+ CI_LOOP = "daily"
+ else:
+ CI_LOOP = "weekly"
+
+ tiers_to_run = []
+
for tier in tiers.get_tiers():
- summary += ("\n - %s. %s:\n\t %s"
- % (tier.get_order(),
- tier.get_name(),
- tier.get_test_names()))
+ if re.search(CI_LOOP, tier.get_ci_loop()) is not None:
+ tiers_to_run.append(tier)
+ summary += ("\n - %s. %s:\n\t %s"
+ % (tier.get_order(),
+ tier.get_name(),
+ tier.get_test_names()))
logger.info("Tiers to be executed:%s" % summary)
- for tier in tiers.get_tiers():
+ for tier in tiers_to_run:
run_tier(tier)