summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jjb/ci_gate_security/anteater-security-audit.sh2
-rw-r--r--jjb/compass4nfv/compass-ci-jobs.yml4
-rwxr-xr-xjjb/dovetail/dovetail-cleanup.sh7
-rwxr-xr-xjjb/dovetail/dovetail-run.sh7
-rwxr-xr-xutils/test/reporting/functest/reporting-status.py1
-rw-r--r--utils/test/reporting/utils/reporting_utils.py27
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/handlers.py35
-rw-r--r--utils/test/testapi/opnfv_testapi/resources/result_handlers.py4
-rw-r--r--utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py34
9 files changed, 89 insertions, 32 deletions
diff --git a/jjb/ci_gate_security/anteater-security-audit.sh b/jjb/ci_gate_security/anteater-security-audit.sh
index 2b5c26a5a..9bd3cc34f 100644
--- a/jjb/ci_gate_security/anteater-security-audit.sh
+++ b/jjb/ci_gate_security/anteater-security-audit.sh
@@ -16,7 +16,7 @@ docker pull opnfv/releng-anteater
echo "--------------------------------------------------------"
cmd="docker run -i $envs $vols --rm opnfv/releng-anteater \
-anteater --project $PROJECT --patchset /home/opnfv/anteater/$PROJECT/patchset"
+/home/opnfv/venv/bin/anteater --project $PROJECT --patchset /home/opnfv/anteater/$PROJECT/patchset"
echo "Running docker container"
echo "$cmd"
$cmd > $WORKSPACE/securityaudit.log 2>&1
diff --git a/jjb/compass4nfv/compass-ci-jobs.yml b/jjb/compass4nfv/compass-ci-jobs.yml
index a2c3c8b5b..24724912a 100644
--- a/jjb/compass4nfv/compass-ci-jobs.yml
+++ b/jjb/compass4nfv/compass-ci-jobs.yml
@@ -398,11 +398,11 @@
- trigger:
name: 'compass-os-ocl-nofeature-ha-baremetal-danube-trigger'
triggers:
- - timed: '0 5 * * *'
+ - timed: ''
- trigger:
name: 'compass-os-onos-sfc-ha-baremetal-danube-trigger'
triggers:
- - timed: ''
+ - timed: '0 5 * * *'
- trigger:
name: 'compass-os-odl_l2-moon-ha-baremetal-danube-trigger'
triggers:
diff --git a/jjb/dovetail/dovetail-cleanup.sh b/jjb/dovetail/dovetail-cleanup.sh
index 0ee789a97..3ae0cbcc9 100755
--- a/jjb/dovetail/dovetail-cleanup.sh
+++ b/jjb/dovetail/dovetail-cleanup.sh
@@ -1,4 +1,11 @@
#!/bin/bash
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
[[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
diff --git a/jjb/dovetail/dovetail-run.sh b/jjb/dovetail/dovetail-run.sh
index 09bf6e1ae..d423e9d29 100755
--- a/jjb/dovetail/dovetail-run.sh
+++ b/jjb/dovetail/dovetail-run.sh
@@ -1,4 +1,11 @@
#!/bin/bash
+##############################################################################
+# Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
#the noun INSTALLER is used in community, here is just the example to run.
#multi-platforms are supported.
diff --git a/utils/test/reporting/functest/reporting-status.py b/utils/test/reporting/functest/reporting-status.py
index e700e047f..77ab7840f 100755
--- a/utils/test/reporting/functest/reporting-status.py
+++ b/utils/test/reporting/functest/reporting-status.py
@@ -107,7 +107,6 @@ for version in versions:
scenario_results = rp_utils.getScenarios(healthcheck,
installer,
version)
-
# get nb of supported architecture (x86, aarch64)
architectures = rp_utils.getArchitectures(scenario_results)
logger.info("Supported architectures: {}".format(architectures))
diff --git a/utils/test/reporting/utils/reporting_utils.py b/utils/test/reporting/utils/reporting_utils.py
index 599a93818..0a178ba1f 100644
--- a/utils/test/reporting/utils/reporting_utils.py
+++ b/utils/test/reporting/utils/reporting_utils.py
@@ -117,19 +117,29 @@ def getScenarios(case, installer, version):
url = ("http://" + url_base + "?case=" + case +
"&period=" + str(period) + "&installer=" + installer +
"&version=" + version)
- request = Request(url)
try:
+ request = Request(url)
response = urlopen(request)
k = response.read()
results = json.loads(k)
test_results = results['results']
- except URLError as e:
- print('Got an error code:', e)
+
+ page = results['pagination']['total_pages']
+ if page > 1:
+ test_results = []
+ for i in range(1, page + 1):
+ url_page = url + "&page=" + str(i)
+ request = Request(url_page)
+ response = urlopen(request)
+ k = response.read()
+ results = json.loads(k)
+ test_results += results['results']
+ except URLError as err:
+ print('Got an error code:', err)
if test_results is not None:
test_results.reverse()
-
scenario_results = {}
for r in test_results:
@@ -157,7 +167,6 @@ def getScenarioStats(scenario_results):
return scenario_stats
-# TODO convergence with above function getScenarios
def getScenarioStatus(installer, version):
period = get_config('general.period')
url_base = get_config('testapi.url')
@@ -213,8 +222,8 @@ def getQtipResults(version, installer):
k = response.read()
response.close()
results = json.loads(k)['results']
- except URLError as e:
- print('Got an error code:', e)
+ except URLError as err:
+ print('Got an error code:', err)
result_dict = {}
if results:
@@ -427,9 +436,9 @@ def export_csv(scenario_file_name, installer, version):
"/functest/scenario_history_" +
installer + ".csv")
scenario_installer_file = open(scenario_installer_file_name, "a")
- with open(scenario_file_name, "r") as f:
+ with open(scenario_file_name, "r") as scenario_file:
scenario_installer_file.write("date,scenario,installer,detail,score\n")
- for line in f:
+ for line in scenario_file:
if installer in line:
scenario_installer_file.write(line)
scenario_installer_file.close
diff --git a/utils/test/testapi/opnfv_testapi/resources/handlers.py b/utils/test/testapi/opnfv_testapi/resources/handlers.py
index 42372e837..0234c8a73 100644
--- a/utils/test/testapi/opnfv_testapi/resources/handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/handlers.py
@@ -105,21 +105,36 @@ class GenericApiHandler(web.RequestHandler):
query = {}
data = []
sort = kwargs.get('sort')
- page = kwargs.get('page')
- last = kwargs.get('last')
- per_page = kwargs.get('per_page')
+ page = kwargs.get('page', 0)
+ last = kwargs.get('last', 0)
+ per_page = kwargs.get('per_page', 0)
cursor = self._eval_db(self.table, 'find', query)
+ records_count = yield cursor.count()
+ records_nr = records_count
+ if (records_count > last) and (last > 0):
+ records_nr = last
+
+ pipelines = list()
+ if query:
+ pipelines.append({'$match': query})
if sort:
- cursor = cursor.sort(sort)
- if last and last != 0:
- cursor = cursor.limit(last)
- if page:
- records_count = yield cursor.count()
- total_pages, remainder = divmod(records_count, per_page)
+ pipelines.append({'$sort': sort})
+
+ if page > 0:
+ total_pages, remainder = divmod(records_nr, per_page)
if remainder > 0:
total_pages += 1
- cursor = cursor.skip((page - 1) * per_page).limit(per_page)
+ pipelines.append({'$skip': (page - 1) * per_page})
+ pipelines.append({'$limit': per_page})
+ else:
+ pipelines.append({'$limit': records_nr})
+
+ cursor = self._eval_db(self.table,
+ 'aggregate',
+ pipelines,
+ allowDiskUse=True)
+
while (yield cursor.fetch_next):
data.append(self.format_data(cursor.next_object()))
if res_op is None:
diff --git a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py
index 208af6da2..1773216c0 100644
--- a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py
+++ b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py
@@ -147,13 +147,13 @@ class ResultsCLHandler(GenericResultHandler):
@in trust_indicator: query
@required trust_indicator: False
"""
- limitations = {'sort': [('start_date', -1)]}
+ limitations = {'sort': {'start_date': -1}}
last = self.get_query_argument('last', 0)
if last is not None:
last = self.get_int('last', last)
limitations.update({'last': last})
- page = self.get_query_argument('page', 1)
+ page = self.get_query_argument('page', None)
if page is not None:
page = self.get_int('page', page)
limitations.update({'page': page,
diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py
index b2564a6de..adaf6f7c3 100644
--- a/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py
+++ b/utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py
@@ -35,15 +35,14 @@ class MemCursor(object):
return self.collection.pop()
def sort(self, key_or_list):
- key = key_or_list[0][0]
- if key_or_list[0][1] == -1:
- reverse = True
- else:
- reverse = False
+ for k, v in key_or_list.iteritems():
+ if v == -1:
+ reverse = True
+ else:
+ reverse = False
- if key_or_list is not None:
self.collection = sorted(self.collection,
- key=itemgetter(key), reverse=reverse)
+ key=itemgetter(k), reverse=reverse)
return self
def limit(self, limit):
@@ -202,6 +201,27 @@ class MemDb(object):
def find(self, *args):
return MemCursor(self._find(*args))
+ def _aggregate(self, *args, **kwargs):
+ res = self.contents
+ print args
+ for arg in args[0]:
+ for k, v in arg.iteritems():
+ if k == '$match':
+ res = self._find(v)
+ cursor = MemCursor(res)
+ for arg in args[0]:
+ for k, v in arg.iteritems():
+ if k == '$sort':
+ cursor = cursor.sort(v)
+ elif k == '$skip':
+ cursor = cursor.skip(v)
+ elif k == '$limit':
+ cursor = cursor.limit(v)
+ return cursor
+
+ def aggregate(self, *args, **kwargs):
+ return self._aggregate(*args, **kwargs)
+
def _update(self, spec, document, check_keys=True):
updated = False