summaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'testcases')
-rwxr-xr-xtestcases/OpenStack/tempest/run_tempest.py59
-rwxr-xr-xtestcases/features/copper.py13
2 files changed, 50 insertions, 22 deletions
diff --git a/testcases/OpenStack/tempest/run_tempest.py b/testcases/OpenStack/tempest/run_tempest.py
index 5d1648dc0..8ca3bdb3f 100755
--- a/testcases/OpenStack/tempest/run_tempest.py
+++ b/testcases/OpenStack/tempest/run_tempest.py
@@ -219,7 +219,7 @@ def configure_tempest_feature(deployment_dir, mode):
if mode == 'feature_multisite':
config.set('service_available', 'kingbird', 'true')
cmd = "openstack endpoint show kingbird | grep publicurl |\
- awk '{print $4}' | awk -F '/' '{print $3}'"
+ awk '{print $4}' | awk -F '/' '{print $4}'"
kingbird_api_version = os.popen(cmd).read()
if os.environ.get("INSTALLER_TYPE") == 'fuel':
# For MOS based setup, the service is accessible
@@ -397,23 +397,41 @@ def run_tempest(OPTION):
dur_sec_int = int(round(dur_sec_float, 0))
dur_sec_int = dur_sec_int + 60 * dur_min
stop_time = time.time()
- # Push results in payload of testcase
- if args.report:
- logger.debug("Pushing tempest results into DB...")
- # Note criteria hardcoded...TODO move to testcase.yaml
- status = "FAIL"
- try:
- diff = (int(num_tests) - int(num_failures))
- success_rate = 100 * diff / int(num_tests)
- except:
- success_rate = 0
- # For Tempest we assume that the success rate is above 90%
- if success_rate >= 90:
+ status = "FAIL"
+ try:
+ diff = (int(num_tests) - int(num_failures))
+ success_rate = 100 * diff / int(num_tests)
+ except:
+ success_rate = 0
+
+ # For Tempest we assume that the success rate is above 90%
+ if "smoke" in args.mode:
+ case_name = "tempest_smoke_serial"
+ # Note criteria hardcoded...TODO read it from testcases.yaml
+ success_criteria = 100
+ if success_rate >= success_criteria:
+ status = "PASS"
+ else:
+ logger.info("Tempest success rate: %s%%. The success criteria to "
+ "pass this test is %s%%. Marking the test as FAILED." %
+ (success_rate, success_criteria))
+ else:
+ case_name = "tempest_full_parallel"
+ # Note criteria hardcoded...TODO read it from testcases.yaml
+ success_criteria = 80
+ if success_rate >= success_criteria:
status = "PASS"
+ else:
+ logger.info("Tempest success rate: %s%%. The success criteria to "
+ "pass this test is %s%%. Marking the test as FAILED." %
+ (success_rate, success_criteria))
+ # Push results in payload of testcase
+ if args.report:
# add the test in error in the details sections
# should be possible to do it during the test
+ logger.debug("Pushing tempest results into DB...")
with open(TEMPEST_RESULTS_DIR + "/tempest.log", 'r') as myfile:
output = myfile.read()
error_logs = ""
@@ -427,10 +445,6 @@ def run_tempest(OPTION):
"errors": error_logs}
logger.info("Results: " + str(json_results))
# split Tempest smoke and full
- if "smoke" in args.mode:
- case_name = "tempest_smoke_serial"
- else:
- case_name = "tempest_full_parallel"
try:
ft_utils.push_results_to_db("functest",
@@ -444,6 +458,11 @@ def run_tempest(OPTION):
logger.error("Error pushing results into Database '%s'"
% sys.exc_info()[0])
+ if status == "PASS":
+ return 0
+ else:
+ return -1
+
def main():
global MODE
@@ -467,7 +486,11 @@ def main():
if args.serial:
MODE += " --concur 1"
- run_tempest(MODE)
+ ret_val = run_tempest(MODE)
+ if ret_val != 0:
+ sys.exit(-1)
+
+ sys.exit(0)
if __name__ == '__main__':
diff --git a/testcases/features/copper.py b/testcases/features/copper.py
index 7ab4e78aa..9efcbd7f4 100755
--- a/testcases/features/copper.py
+++ b/testcases/features/copper.py
@@ -16,11 +16,12 @@
#
import os
+import sys
import time
-import yaml
-
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as functest_utils
+import yaml
+
with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
functest_yaml = yaml.safe_load(f)
@@ -38,11 +39,11 @@ def main():
start_time = time.time()
- ret = functest_utils.execute_command(cmd, logger, exit_on_error=False)
+ ret_val = functest_utils.execute_command(cmd, logger, exit_on_error=False)
stop_time = time.time()
duration = round(stop_time - start_time, 1)
- if ret == 0:
+ if ret_val == 0:
logger.info("COPPER PASSED")
test_status = 'PASS'
else:
@@ -76,6 +77,10 @@ def main():
stop_time,
details['status'],
details)
+ if ret_val != 0:
+ sys.exit(-1)
+
+ sys.exit(0)
if __name__ == '__main__':
main()