summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-06-10 17:15:28 +0200
committerMorgan Richomme <morgan.richomme@orange.com>2016-06-10 17:53:56 +0200
commit8652c7157689f524e7c25f6fd5c85ed9391cfd73 (patch)
tree6d5c7442f10d8e20cb3e3a9e4d856e9db827275a
parentcdff7d8d41693971f4c5dc8dd18d6907a5e31937 (diff)
Adapt automatic reporting to new Test API
JIRA: FUNCTEST-303 Change-Id: Ie9cb7151301ab2c26a72746683c35305ba560bbc Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
-rw-r--r--utils/test/reporting/functest/reporting-tempest.py12
-rw-r--r--utils/test/reporting/functest/reporting-vims.py8
-rw-r--r--utils/test/reporting/functest/reportingConf.py4
-rw-r--r--utils/test/reporting/functest/reportingUtils.py14
4 files changed, 20 insertions, 18 deletions
diff --git a/utils/test/reporting/functest/reporting-tempest.py b/utils/test/reporting/functest/reporting-tempest.py
index 70fb57702..e9662d5c2 100644
--- a/utils/test/reporting/functest/reporting-tempest.py
+++ b/utils/test/reporting/functest/reporting-tempest.py
@@ -7,10 +7,10 @@ installers = ["apex", "compass", "fuel", "joid"]
items = ["tests", "Success rate", "duration"]
PERIOD = 7
-
+print "Generate Tempest automatic reporting"
for installer in installers:
# we consider the Tempest results of the last PERIOD days
- url = "http://testresults.opnfv.org/testapi/results?case=Tempest"
+ url = "http://testresults.opnfv.org/test/api/v1/results?case=Tempest"
request = Request(url + '&period=' + str(PERIOD)
+ '&installer=' + installer + '&version=master')
@@ -21,7 +21,7 @@ for installer in installers:
except URLError, e:
print 'No kittez. Got an error code:', e
- test_results = results['test_results']
+ test_results = results['results']
test_results.reverse()
scenario_results = {}
@@ -41,7 +41,7 @@ for installer in installers:
# For each scenario, we build a result object to deal with
# results, criteria and error handling
for result in scenario_results[s]:
- result["creation_date"] = result["creation_date"].split(".")[0]
+ result["start_date"] = result["start_date"].split(".")[0]
# retrieve results
# ****************
@@ -96,5 +96,7 @@ for installer in installers:
items=items,
installer=installer)
- with open("./release/index-tempest-" + installer + ".html", "wb") as fh:
+ with open("./release/master/index-tempest-" +
+ installer + ".html", "wb") as fh:
fh.write(outputText)
+print "Tempest automatic reporting Done"
diff --git a/utils/test/reporting/functest/reporting-vims.py b/utils/test/reporting/functest/reporting-vims.py
index 78ca9f5b3..5ba92d6c3 100644
--- a/utils/test/reporting/functest/reporting-vims.py
+++ b/utils/test/reporting/functest/reporting-vims.py
@@ -24,7 +24,7 @@ installers = ["fuel", "compass", "joid", "apex"]
step_order = ["initialisation", "orchestrator", "vIMS", "sig_test"]
for installer in installers:
- request = Request('http://testresults.opnfv.org/testapi/results?case=vIMS&installer=' + installer)
+ request = Request('http://testresults.opnfv.org/test/api/v1/results?case=vIMS&installer=' + installer)
try:
response = urlopen(request)
@@ -33,7 +33,7 @@ for installer in installers:
except URLError, e:
print 'No kittez. Got an error code:', e
- test_results = results['test_results']
+ test_results = results['results']
test_results.reverse()
scenario_results = {}
@@ -45,7 +45,7 @@ for installer in installers:
for s, s_result in scenario_results.items():
scenario_results[s] = s_result[0:5]
for result in scenario_results[s]:
- result["creation_date"] = result["creation_date"].split(".")[0]
+ result["start_date"] = result["start_date"].split(".")[0]
sig_test = result['details']['sig_test']['result']
if not sig_test == "" and isinstance(sig_test, list):
format_result = sig_test_format(sig_test)
@@ -77,7 +77,7 @@ for installer in installers:
outputText = template.render( scenario_results = scenario_results, step_order = step_order, installer = installer)
- with open("./release/index-vims" + installer + ".html", "wb") as fh:
+ with open("./release/master/index-vims-" + installer + ".html", "wb") as fh:
fh.write(outputText)
diff --git a/utils/test/reporting/functest/reportingConf.py b/utils/test/reporting/functest/reportingConf.py
index e4c4548c8..e390a18d2 100644
--- a/utils/test/reporting/functest/reportingConf.py
+++ b/utils/test/reporting/functest/reportingConf.py
@@ -11,7 +11,7 @@
# ****************************************************
installers = ["apex", "compass", "fuel", "joid"]
# installers = ["compass"]
-versions = ["brahmaputra", "master"]
-# versions = ["master"]
+# versions = ["brahmaputra", "master"]
+versions = ["master"]
PERIOD = 10
MAX_SCENARIO_CRITERIA = 18
diff --git a/utils/test/reporting/functest/reportingUtils.py b/utils/test/reporting/functest/reportingUtils.py
index f8d64aa88..7170b8398 100644
--- a/utils/test/reporting/functest/reportingUtils.py
+++ b/utils/test/reporting/functest/reportingUtils.py
@@ -19,7 +19,7 @@ def getApiResults(case, installer, scenario, version):
# urllib2.install_opener(opener)
# url = "http://127.0.0.1:8000/results?case=" + case + \
# "&period=30&installer=" + installer
- url = ("http://testresults.opnfv.org/testapi/results?case=" + case +
+ url = ("http://testresults.opnfv.org/test/api/v1/results?case=" + case +
"&period=" + str(reportingConf.PERIOD) + "&installer=" + installer +
"&scenario=" + scenario + "&version=" + version)
request = Request(url)
@@ -37,7 +37,8 @@ def getApiResults(case, installer, scenario, version):
def getScenarios(case, installer, version):
case = case.getName()
- url = ("http://testresults.opnfv.org/testapi/results?case=" + case +
+ print case
+ url = ("http://testresults.opnfv.org/test/api/v1/results?case=" + case +
"&period=" + str(reportingConf.PERIOD) + "&installer=" + installer +
"&version=" + version)
request = Request(url)
@@ -46,11 +47,10 @@ def getScenarios(case, installer, version):
response = urlopen(request)
k = response.read()
results = json.loads(k)
+ test_results = results['results']
except URLError, e:
print 'Got an error code:', e
- test_results = results['test_results']
-
if test_results is not None:
test_results.reverse()
@@ -78,7 +78,7 @@ def getNbtestOk(results):
for r in results:
for k, v in r.iteritems():
try:
- if "passed" in v:
+ if "PASS" in v:
nb_test_ok += 1
except:
print "Cannot retrieve test status"
@@ -90,7 +90,7 @@ def getResult(testCase, installer, scenario, version):
# retrieve raw results
results = getApiResults(testCase, installer, scenario, version)
# let's concentrate on test results only
- test_results = results['test_results']
+ test_results = results['results']
# if results found, analyze them
if test_results is not None:
@@ -106,7 +106,7 @@ def getResult(testCase, installer, scenario, version):
for r in test_results:
# print r["creation_date"]
# print r["criteria"]
- scenario_results.append({r["creation_date"]: r["criteria"]})
+ scenario_results.append({r["start_date"]: r["criteria"]})
# sort results
scenario_results.sort()
# 4 levels for the results