summaryrefslogtreecommitdiffstats
path: root/test/functest/tempest.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-07-14 13:40:35 +0200
committerjose.lausuch <jose.lausuch@ericsson.com>2016-07-14 15:57:30 +0200
commit014a4b881926cd66d845c1850eb3df174d49e25e (patch)
tree62f6f2e6faceb831c8e25c87d1796768d330b448 /test/functest/tempest.py
parent95252994f4b1ff4369c49ce4ef024469d8b6df7d (diff)
Add support to push the results to the DB
JIRA: SDNVPN-19 The test scripts now return a json object with the following format: {"status": criteria, "details": results} where criteria: "PASS"|"FAILED" (result of the test case) details: free output that will be printed to the console and pushed to the DB Change-Id: I9e5e0c3b6cb5f4b060929b71a06f6e4f95f814fb Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'test/functest/tempest.py')
-rw-r--r--test/functest/tempest.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/functest/tempest.py b/test/functest/tempest.py
index 8d4b664..832cb4a 100644
--- a/test/functest/tempest.py
+++ b/test/functest/tempest.py
@@ -15,7 +15,14 @@ import shutil
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
-logger = ft_logger.Logger("bgpvpn").getLogger()
+
+logger = ft_logger.Logger("sdnvpn-tempest").getLogger()
+
+REPO_PATH = os.environ['repos_dir'] + '/sdnvpn/'
+config_file = REPO_PATH + 'test/functest/config.yaml'
+
+SUCCESS_CRITERIA = ft_utils.get_parameter_from_yaml(
+ "testcases.testcase_1.succes_criteria", config_file)
def main():
@@ -68,11 +75,13 @@ def main():
# Look for name of the tests
testcases = re.findall("\{0\} (.*)", output)
- results = {"test_name": "tempest", "duration": duration,
+ results = {"duration": duration,
"num_tests": num_tests, "failed": failed,
"tests": testcases}
- logger.info("Results: %s" % results)
- return results
+ status = "PASS"
+ if 100 - (100 * int(failed) / int(num_tests)) < int(SUCCESS_CRITERIA):
+ status = "FAILED"
+ return {"status": status, "details": results}
except:
logger.error("Problem when parsing the results.")