summaryrefslogtreecommitdiffstats
path: root/utils/test
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
commitbbdf9f2a5ce6ef146a872aa0914588df714c1d95 (patch)
treecfce52d6f38e14426668daa74a3fb8a856e3279e /utils/test
parentdd67e264f4b5c01b9b493d215377b15c1a953c4b (diff)
Add Tempest error in Tempest reporting
JIRA: FUNCTEST-150 Change-Id: I0b2a3a38bbbb11a80c761c23c71c2f45a959e477 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'utils/test')
-rw-r--r--utils/test/reporting/functest/reporting-tempest.py51
-rw-r--r--utils/test/reporting/functest/template/index-tempest-tmpl.html8
2 files changed, 32 insertions, 27 deletions
diff --git a/utils/test/reporting/functest/reporting-tempest.py b/utils/test/reporting/functest/reporting-tempest.py
index 563e53010..70fb57702 100644
--- a/utils/test/reporting/functest/reporting-tempest.py
+++ b/utils/test/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/utils/test/reporting/functest/template/index-tempest-tmpl.html b/utils/test/reporting/functest/template/index-tempest-tmpl.html
index be0b79734..b8260ed3c 100644
--- a/utils/test/reporting/functest/template/index-tempest-tmpl.html
+++ b/utils/test/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 %}