summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-05-31 16:38:58 +0200
committerJose Lausuch <jose.lausuch@ericsson.com>2016-05-31 14:45:47 +0000
commitfb04039e901a45a14d2ad3ca161602853fb107fa (patch)
tree9d9b23d3e13101f8ad050d4eb3f95dacc9e8fab7
parentfa69670740d165b896eebd9efaa071482f0b8fd8 (diff)
Add Tempest error in Tempest reporting
JIRA: FUNCTEST-150 Change-Id: I0b2a3a38bbbb11a80c761c23c71c2f45a959e477 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
-rw-r--r--reporting/functest/reporting-tempest.py51
-rw-r--r--reporting/functest/template/index-tempest-tmpl.html8
2 files changed, 32 insertions, 27 deletions
diff --git a/reporting/functest/reporting-tempest.py b/reporting/functest/reporting-tempest.py
index 563e530..70fb577 100644
--- a/reporting/functest/reporting-tempest.py
+++ b/reporting/functest/reporting-tempest.py
@@ -6,10 +6,13 @@ import os
installers = ["apex", "compass", "fuel", "joid"]
items = ["tests", "Success rate", "duration"]
+PERIOD = 7
+
for installer in installers:
- # we consider the Tempest results of the last 7 days
+ # we consider the Tempest results of the last PERIOD days
url = "http://testresults.opnfv.org/testapi/results?case=Tempest"
- request = Request(url + '&period=7&installer=' + installer)
+ request = Request(url + '&period=' + str(PERIOD)
+ + '&installer=' + installer + '&version=master')
try:
response = urlopen(request)
@@ -27,9 +30,11 @@ for installer in installers:
for r in test_results:
# Retrieve all the scenarios per installer
- if not r['version'] in scenario_results.keys():
- scenario_results[r['version']] = []
- scenario_results[r['version']].append(r)
+ # In Brahmaputra use version
+ # Since Colorado use scenario
+ if not r['scenario'] in scenario_results.keys():
+ scenario_results[r['scenario']] = []
+ scenario_results[r['scenario']].append(r)
for s, s_result in scenario_results.items():
scenario_results[s] = s_result[0:5]
@@ -41,8 +46,10 @@ for installer in installers:
# retrieve results
# ****************
nb_tests_run = result['details']['tests']
+ nb_tests_failed = result['details']['failures']
if nb_tests_run != 0:
- success_rate = 100*(int(result['details']['tests']) - int(result['details']['failures']))/int(result['details']['tests'])
+ success_rate = 100*(int(nb_tests_run)
+ - int(nb_tests_failed))/int(nb_tests_run)
else:
success_rate = 0
@@ -55,38 +62,32 @@ for installer in installers:
crit_rate = False
crit_time = False
- # Expect that at least 200 tests are run
- if nb_tests_run >= 200:
+ # Expect that at least 165 tests are run
+ if nb_tests_run >= 165:
crit_tests = True
# Expect that at least 90% of success
if success_rate >= 90:
crit_rate = True
- # Expect that the suite duration is inferior to 45m
- if result['details']['duration'] < 2700:
+ # Expect that the suite duration is inferior to 30m
+ if result['details']['duration'] < 1800:
crit_time = True
result['criteria'] = {'tests': crit_tests,
'Success rate': crit_rate,
'duration': crit_time}
-
# error management
# ****************
-
- # TODO get information from artefact based on build tag
- # to identify errors of the associated run
- # build tag needed to wget errors on the artifacts
- # the idea is to list the tests in errors and provide the link
- # towards complete artifact
- # another option will be to put the errors in the DB
- # (in the detail section)...
- result['errors'] = {'tests': "",
- 'Success rate': "",
- 'duration': ""}
-
- templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__)))
- templateEnv = jinja2.Environment(loader=templateLoader)
+ try:
+ errors = result['details']['errors']
+ result['errors'] = errors.replace('{0}', '')
+ except:
+ print "Error field not present (Brahamputra runs?)"
+
+ mypath = os.path.abspath(__file__)
+ tplLoader = jinja2.FileSystemLoader(os.path.dirname(mypath))
+ templateEnv = jinja2.Environment(loader=tplLoader)
TEMPLATE_FILE = "./template/index-tempest-tmpl.html"
template = templateEnv.get_template(TEMPLATE_FILE)
diff --git a/reporting/functest/template/index-tempest-tmpl.html b/reporting/functest/template/index-tempest-tmpl.html
index be0b797..b8260ed 100644
--- a/reporting/functest/template/index-tempest-tmpl.html
+++ b/reporting/functest/template/index-tempest-tmpl.html
@@ -67,14 +67,18 @@
<td>{{item}}</td>
<td>{{result.details[item]}}</td>
<td><span class="glyphicon glyphicon-ok"></td>
- <td>{{result.errors[item]}}</td>
+ {% if item is equalto "Success rate" %}
+ <td>{{result.errors}}</td>
+ {% endif %}
</tr>
{%- else -%}
<tr class="tr-danger">
<td>{{item}}</td>
<td>{{result.details[item]}}</td>
<td><span class="glyphicon glyphicon-remove"></td>
- <td>{{result.errors[item]}}</td>
+ {% if item is equalto "Success rate" %}
+ <td>{{result.errors}}</td>
+ {% endif %}
</tr>
{%- endif %}
{%- endif %}