diff options
Diffstat (limited to 'utils/test/reporting')
-rw-r--r-- | utils/test/reporting/api/__init__.py (renamed from utils/test/reporting/api/api/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/api/conf.py (renamed from utils/test/reporting/api/api/conf.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/api/handlers/__init__.py (renamed from utils/test/reporting/api/api/handlers/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/api/handlers/landing.py (renamed from utils/test/reporting/api/api/handlers/landing.py) | 78 | ||||
-rw-r--r-- | utils/test/reporting/api/handlers/projects.py (renamed from utils/test/reporting/api/api/handlers/projects.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/api/handlers/testcases.py (renamed from utils/test/reporting/api/api/handlers/testcases.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/api/requirements.txt | 3 | ||||
-rw-r--r-- | utils/test/reporting/api/server.py (renamed from utils/test/reporting/api/api/server.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/api/setup.cfg | 32 | ||||
-rw-r--r-- | utils/test/reporting/api/setup.py | 9 | ||||
-rw-r--r-- | utils/test/reporting/api/urls.py (renamed from utils/test/reporting/api/api/urls.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/docker/Dockerfile | 33 | ||||
-rw-r--r-- | utils/test/reporting/docker/nginx.conf | 4 | ||||
-rwxr-xr-x | utils/test/reporting/docker/reporting.sh | 68 | ||||
-rw-r--r-- | utils/test/reporting/docker/requirements.pip | 1 | ||||
-rw-r--r-- | utils/test/reporting/docker/supervisor.conf | 15 | ||||
-rwxr-xr-x | utils/test/reporting/docker/web_server.sh | 14 | ||||
-rw-r--r-- | utils/test/reporting/docs/_build/.buildinfo | 4 | ||||
-rw-r--r-- | utils/test/reporting/docs/_build/.doctrees/environment.pickle | bin | 0 -> 4207 bytes | |||
-rw-r--r-- | utils/test/reporting/docs/_build/.doctrees/index.doctree | bin | 0 -> 4892 bytes | |||
-rw-r--r-- | utils/test/reporting/docs/conf.py | 341 | ||||
-rw-r--r-- | utils/test/reporting/docs/index.rst | 16 | ||||
-rwxr-xr-x | utils/test/reporting/pages/angular.sh | 5 | ||||
-rw-r--r-- | utils/test/reporting/pages/app/index.html | 3 | ||||
-rw-r--r-- | utils/test/reporting/pages/app/scripts/controllers/table.controller.js | 555 | ||||
-rw-r--r-- | utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js | 17 | ||||
-rw-r--r-- | utils/test/reporting/pages/app/scripts/factory/table.factory.js | 52 | ||||
-rw-r--r-- | utils/test/reporting/pages/app/views/commons/table.html | 28 | ||||
-rw-r--r-- | utils/test/reporting/pages/app/views/commons/testCaseVisual.html | 4 | ||||
-rwxr-xr-x | utils/test/reporting/pages/config.sh | 3 | ||||
-rw-r--r-- | utils/test/reporting/reporting/__init__.py (renamed from utils/test/reporting/functest/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/functest/__init__.py (renamed from utils/test/reporting/qtip/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_0.png (renamed from utils/test/reporting/functest/img/gauge_0.png) | bin | 3644 -> 3644 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_100.png (renamed from utils/test/reporting/functest/img/gauge_100.png) | bin | 3191 -> 3191 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_16.7.png (renamed from utils/test/reporting/functest/img/gauge_16.7.png) | bin | 3170 -> 3170 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_25.png (renamed from utils/test/reporting/functest/img/gauge_25.png) | bin | 3108 -> 3108 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_33.3.png (renamed from utils/test/reporting/functest/img/gauge_33.3.png) | bin | 3081 -> 3081 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_41.7.png (renamed from utils/test/reporting/functest/img/gauge_41.7.png) | bin | 3169 -> 3169 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_50.png (renamed from utils/test/reporting/functest/img/gauge_50.png) | bin | 3123 -> 3123 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_58.3.png (renamed from utils/test/reporting/functest/img/gauge_58.3.png) | bin | 3161 -> 3161 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_66.7.png (renamed from utils/test/reporting/functest/img/gauge_66.7.png) | bin | 3069 -> 3069 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_75.png (renamed from utils/test/reporting/functest/img/gauge_75.png) | bin | 3030 -> 3030 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_8.3.png (renamed from utils/test/reporting/functest/img/gauge_8.3.png) | bin | 2993 -> 2993 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_83.3.png (renamed from utils/test/reporting/functest/img/gauge_83.3.png) | bin | 3122 -> 3122 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/gauge_91.7.png (renamed from utils/test/reporting/functest/img/gauge_91.7.png) | bin | 3008 -> 3008 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/icon-nok.png (renamed from utils/test/reporting/functest/img/icon-nok.png) | bin | 2317 -> 2317 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/icon-ok.png (renamed from utils/test/reporting/functest/img/icon-ok.png) | bin | 4063 -> 4063 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/weather-clear.png (renamed from utils/test/reporting/functest/img/weather-clear.png) | bin | 1560 -> 1560 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/weather-few-clouds.png (renamed from utils/test/reporting/functest/img/weather-few-clouds.png) | bin | 1927 -> 1927 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/weather-overcast.png (renamed from utils/test/reporting/functest/img/weather-overcast.png) | bin | 1588 -> 1588 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/img/weather-storm.png (renamed from utils/test/reporting/functest/img/weather-storm.png) | bin | 2137 -> 2137 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/functest/index.html (renamed from utils/test/reporting/functest/index.html) | 0 | ||||
-rwxr-xr-x | utils/test/reporting/reporting/functest/reporting-status.py (renamed from utils/test/reporting/functest/reporting-status.py) | 8 | ||||
-rwxr-xr-x | utils/test/reporting/reporting/functest/reporting-tempest.py (renamed from utils/test/reporting/functest/reporting-tempest.py) | 21 | ||||
-rwxr-xr-x | utils/test/reporting/reporting/functest/reporting-vims.py (renamed from utils/test/reporting/functest/reporting-vims.py) | 4 | ||||
-rw-r--r-- | utils/test/reporting/reporting/functest/scenarioResult.py (renamed from utils/test/reporting/functest/scenarioResult.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/functest/template/index-status-tmpl.html (renamed from utils/test/reporting/functest/template/index-status-tmpl.html) | 30 | ||||
-rw-r--r-- | utils/test/reporting/reporting/functest/template/index-tempest-tmpl.html (renamed from utils/test/reporting/functest/template/index-tempest-tmpl.html) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/functest/template/index-vims-tmpl.html (renamed from utils/test/reporting/functest/template/index-vims-tmpl.html) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/functest/testCase.py (renamed from utils/test/reporting/functest/testCase.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/qtip/__init__.py (renamed from utils/test/reporting/tests/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/qtip/index.html (renamed from utils/test/reporting/qtip/index.html) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/qtip/reporting-status.py (renamed from utils/test/reporting/qtip/reporting-status.py) | 7 | ||||
-rw-r--r-- | utils/test/reporting/reporting/qtip/template/index-status-tmpl.html (renamed from utils/test/reporting/qtip/template/index-status-tmpl.html) | 9 | ||||
-rw-r--r-- | utils/test/reporting/reporting/reporting.yaml (renamed from utils/test/reporting/reporting.yaml) | 1 | ||||
-rw-r--r-- | utils/test/reporting/reporting/storperf/__init__.py (renamed from utils/test/reporting/tests/unit/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/storperf/reporting-status.py (renamed from utils/test/reporting/storperf/reporting-status.py) | 2 | ||||
-rw-r--r-- | utils/test/reporting/reporting/storperf/template/index-status-tmpl.html (renamed from utils/test/reporting/storperf/template/index-status-tmpl.html) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/tests/__init__.py (renamed from utils/test/reporting/tests/unit/utils/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/tests/unit/__init__.py (renamed from utils/test/reporting/utils/__init__.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/tests/unit/utils/__init__.py (renamed from utils/test/reporting/pages/app/scripts/app.config.js) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/tests/unit/utils/test_utils.py (renamed from utils/test/reporting/tests/unit/utils/test_utils.py) | 9 | ||||
-rw-r--r-- | utils/test/reporting/reporting/utils/__init__.py | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/utils/reporting_utils.py (renamed from utils/test/reporting/utils/reporting_utils.py) | 47 | ||||
-rw-r--r-- | utils/test/reporting/reporting/utils/scenarioResult.py (renamed from utils/test/reporting/utils/scenarioResult.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/__init__.py | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_0.png (renamed from utils/test/reporting/yardstick/img/gauge_0.png) | bin | 3644 -> 3644 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_100.png (renamed from utils/test/reporting/yardstick/img/gauge_100.png) | bin | 3191 -> 3191 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_16.7.png (renamed from utils/test/reporting/yardstick/img/gauge_16.7.png) | bin | 3170 -> 3170 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_25.png (renamed from utils/test/reporting/yardstick/img/gauge_25.png) | bin | 3108 -> 3108 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_33.3.png (renamed from utils/test/reporting/yardstick/img/gauge_33.3.png) | bin | 3081 -> 3081 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_41.7.png (renamed from utils/test/reporting/yardstick/img/gauge_41.7.png) | bin | 3169 -> 3169 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_50.png (renamed from utils/test/reporting/yardstick/img/gauge_50.png) | bin | 3123 -> 3123 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_58.3.png (renamed from utils/test/reporting/yardstick/img/gauge_58.3.png) | bin | 3161 -> 3161 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_66.7.png (renamed from utils/test/reporting/yardstick/img/gauge_66.7.png) | bin | 3069 -> 3069 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_75.png (renamed from utils/test/reporting/yardstick/img/gauge_75.png) | bin | 3030 -> 3030 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_8.3.png (renamed from utils/test/reporting/yardstick/img/gauge_8.3.png) | bin | 2993 -> 2993 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_83.3.png (renamed from utils/test/reporting/yardstick/img/gauge_83.3.png) | bin | 3122 -> 3122 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/gauge_91.7.png (renamed from utils/test/reporting/yardstick/img/gauge_91.7.png) | bin | 3008 -> 3008 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/icon-nok.png (renamed from utils/test/reporting/yardstick/img/icon-nok.png) | bin | 2317 -> 2317 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/icon-ok.png (renamed from utils/test/reporting/yardstick/img/icon-ok.png) | bin | 4063 -> 4063 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/weather-clear.png (renamed from utils/test/reporting/yardstick/img/weather-clear.png) | bin | 1560 -> 1560 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/weather-few-clouds.png (renamed from utils/test/reporting/yardstick/img/weather-few-clouds.png) | bin | 1927 -> 1927 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/weather-overcast.png (renamed from utils/test/reporting/yardstick/img/weather-overcast.png) | bin | 1588 -> 1588 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/img/weather-storm.png (renamed from utils/test/reporting/yardstick/img/weather-storm.png) | bin | 2137 -> 2137 bytes | |||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/index.html (renamed from utils/test/reporting/yardstick/index.html) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/reporting-status.py (renamed from utils/test/reporting/yardstick/reporting-status.py) | 2 | ||||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/scenarios.py (renamed from utils/test/reporting/yardstick/scenarios.py) | 0 | ||||
-rw-r--r-- | utils/test/reporting/reporting/yardstick/template/index-status-tmpl.html (renamed from utils/test/reporting/yardstick/template/index-status-tmpl.html) | 0 | ||||
-rw-r--r-- | utils/test/reporting/requirements.txt | 7 | ||||
-rwxr-xr-x | utils/test/reporting/run_test.sh | 3 | ||||
-rwxr-xr-x | utils/test/reporting/run_unit_tests.sh | 43 | ||||
-rw-r--r-- | utils/test/reporting/setup.cfg | 12 | ||||
-rw-r--r-- | utils/test/reporting/setup.py | 31 | ||||
-rw-r--r-- | utils/test/reporting/test-requirements.txt | 5 | ||||
-rw-r--r-- | utils/test/reporting/tox.ini | 27 |
106 files changed, 921 insertions, 632 deletions
diff --git a/utils/test/reporting/api/api/__init__.py b/utils/test/reporting/api/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/reporting/api/api/__init__.py +++ b/utils/test/reporting/api/__init__.py diff --git a/utils/test/reporting/api/api/conf.py b/utils/test/reporting/api/conf.py index 5897d4f97..5897d4f97 100644 --- a/utils/test/reporting/api/api/conf.py +++ b/utils/test/reporting/api/conf.py diff --git a/utils/test/reporting/api/api/handlers/__init__.py b/utils/test/reporting/api/handlers/__init__.py index bcda66438..bcda66438 100644 --- a/utils/test/reporting/api/api/handlers/__init__.py +++ b/utils/test/reporting/api/handlers/__init__.py diff --git a/utils/test/reporting/api/api/handlers/landing.py b/utils/test/reporting/api/handlers/landing.py index 749916fb6..0bf602dc9 100644 --- a/utils/test/reporting/api/api/handlers/landing.py +++ b/utils/test/reporting/api/handlers/landing.py @@ -7,6 +7,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## import requests +import time from tornado.escape import json_encode from tornado.escape import json_decode @@ -24,7 +25,7 @@ class FiltersHandler(BaseHandler): 'status': ['success', 'warning', 'danger'], 'projects': ['functest', 'yardstick'], 'installers': ['apex', 'compass', 'fuel', 'joid'], - 'version': ['colorado', 'master'], + 'version': ['master', 'colorado', 'danube'], 'loops': ['daily', 'weekly', 'monthly'], 'time': ['10 days', '30 days'] } @@ -53,27 +54,27 @@ class ScenariosHandler(BaseHandler): def _get_scenario_result(self, scenario, data, args): result = { 'status': data.get('status'), - 'installers': self._get_installers_result(data['installers'], args) + 'installers': self._get_installers_result(data, args) } return result def _get_installers_result(self, data, args): func = self._get_installer_result - return {k: func(k, data.get(k, {}), args) for k in args['installers']} + return {k: func(data.get(k, {}), args) for k in args['installers']} - def _get_installer_result(self, installer, data, args): - projects = data.get(args['version'], []) - return [self._get_project_data(projects, p) for p in args['projects']] + def _get_installer_result(self, data, args): + return self._get_version_data(data.get(args['version'], {}), args) - def _get_project_data(self, projects, project): + def _get_version_data(self, data, args): + return {k: self._get_project_data(data.get(k, {})) + for k in args['projects']} + + def _get_project_data(self, data): atom = { - 'project': project, - 'score': None, - 'status': None + 'score': data.get('score', ''), + 'status': data.get('status', '') } - for p in projects: - if p['project'] == project: - return p + return atom def _get_scenarios(self): @@ -88,41 +89,42 @@ class ScenariosHandler(BaseHandler): []) ) for a in data} scenario = { - 'status': self._get_status(), - 'installers': installers + 'status': self._get_status() } + scenario.update(installers) + return scenario def _get_status(self): return 'success' def _get_installer(self, data): - return {a.get('version'): self._get_version(a) for a in data} + return {a.get('version'): self._get_version(a.get('projects')) + for a in data} def _get_version(self, data): + return {a.get('project'): self._get_project(a) for a in data} + + def _get_project(self, data): + scores = data.get('scores', []) + trusts = data.get('trust_indicators', []) + try: - scores = data.get('score', {}).get('projects')[0] - trusts = data.get('trust_indicator', {}).get('projects')[0] - except (TypeError, IndexError): - return [] - else: - scores = {key: [dict(date=a.get('date')[:10], - score=a.get('score') - ) for a in scores[key]] for key in scores} - trusts = {key: [dict(date=a.get('date')[:10], - status=a.get('status') - ) for a in trusts[key]] for key in trusts} - atom = self._get_atom(scores, trusts) - return [dict(project=k, - score=sorted(atom[k], reverse=True)[0].get('score'), - status=sorted(atom[k], reverse=True)[0].get('status') - ) for k in atom if atom[k]] - - def _get_atom(self, scores, trusts): - s = {k: {a['date']: a['score'] for a in scores[k]} for k in scores} - t = {k: {a['date']: a['status'] for a in trusts[k]} for k in trusts} - return {k: [dict(score=s[k][a], status=t[k][a], data=a - ) for a in s[k] if a in t[k]] for k in s} + date = sorted(scores, reverse=True)[0].get('date') + except IndexError: + data = time.time() + + try: + score = sorted(scores, reverse=True)[0].get('score') + except IndexError: + score = None + + try: + status = sorted(trusts, reverse=True)[0].get('status') + except IndexError: + status = None + + return {'date': date, 'score': score, 'status': status} def _change_to_utf8(self, obj): if isinstance(obj, dict): diff --git a/utils/test/reporting/api/api/handlers/projects.py b/utils/test/reporting/api/handlers/projects.py index 02412cd62..02412cd62 100644 --- a/utils/test/reporting/api/api/handlers/projects.py +++ b/utils/test/reporting/api/handlers/projects.py diff --git a/utils/test/reporting/api/api/handlers/testcases.py b/utils/test/reporting/api/handlers/testcases.py index 2b9118623..2b9118623 100644 --- a/utils/test/reporting/api/api/handlers/testcases.py +++ b/utils/test/reporting/api/handlers/testcases.py diff --git a/utils/test/reporting/api/requirements.txt b/utils/test/reporting/api/requirements.txt deleted file mode 100644 index 12ad6881b..000000000 --- a/utils/test/reporting/api/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -tornado==4.4.2 -requests==2.1.0 - diff --git a/utils/test/reporting/api/api/server.py b/utils/test/reporting/api/server.py index e340b0181..e340b0181 100644 --- a/utils/test/reporting/api/api/server.py +++ b/utils/test/reporting/api/server.py diff --git a/utils/test/reporting/api/setup.cfg b/utils/test/reporting/api/setup.cfg deleted file mode 100644 index 53d1092b9..000000000 --- a/utils/test/reporting/api/setup.cfg +++ /dev/null @@ -1,32 +0,0 @@ -[metadata] -name = reporting - -author = JackChan -author-email = chenjiankun1@huawei.com - -classifier = - Environment :: opnfv - Intended Audience :: Information Technology - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Operating System :: POSIX :: Linux - Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 - -[global] -setup-hooks = - pbr.hooks.setup_hook - -[files] -packages = - api - -[entry_points] -console_scripts = - api = api.server:main - -[egg_info] -tag_build = -tag_date = 0 -tag_svn_revision = 0 diff --git a/utils/test/reporting/api/setup.py b/utils/test/reporting/api/setup.py deleted file mode 100644 index d97481642..000000000 --- a/utils/test/reporting/api/setup.py +++ /dev/null @@ -1,9 +0,0 @@ -import setuptools - - -__author__ = 'JackChan' - - -setuptools.setup( - setup_requires=['pbr>=1.8'], - pbr=True) diff --git a/utils/test/reporting/api/api/urls.py b/utils/test/reporting/api/urls.py index a5228b2d4..a5228b2d4 100644 --- a/utils/test/reporting/api/api/urls.py +++ b/utils/test/reporting/api/urls.py diff --git a/utils/test/reporting/docker/Dockerfile b/utils/test/reporting/docker/Dockerfile index ad278ce1e..f2357909d 100644 --- a/utils/test/reporting/docker/Dockerfile +++ b/utils/test/reporting/docker/Dockerfile @@ -16,38 +16,43 @@ FROM nginx:stable MAINTAINER Morgan Richomme <morgan.richomme@orange.com> -LABEL version="danube.1.0" description="OPNFV Test Reporting Docker container" +LABEL version="1.0" description="OPNFV Test Reporting Docker container" ARG BRANCH=master ENV HOME /home/opnfv -ENV working_dir /home/opnfv/utils/test/reporting -ENV TERM xterm -ENV COLORTERM gnome-terminal -ENV CONFIG_REPORTING_YAML /home/opnfv/utils/test/reporting/reporting.yaml +ENV working_dir ${HOME}/releng/utils/test/reporting +ENV CONFIG_REPORTING_YAML ${working_dir}/reporting.yaml +WORKDIR ${HOME} # Packaged dependencies RUN apt-get update && apt-get install -y \ +build-essential \ ssh \ +curl \ +gnupg \ python-pip \ +python-dev \ +python-setuptools \ git-core \ -wkhtmltopdf \ -nodejs \ -npm \ supervisor \ --no-install-recommends -RUN pip install --upgrade pip +RUN pip install --upgrade pip && easy_install -U setuptools==30.0.0 -RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng /home/opnfv -RUN pip install -r ${working_dir}/docker/requirements.pip +RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng /home/opnfv/releng +RUN pip install -r ${working_dir}/requirements.txt -WORKDIR ${working_dir}/api -RUN pip install -r requirements.txt -RUN python setup.py install +RUN sh -c 'curl -sL https://deb.nodesource.com/setup_8.x | bash -' \ + && apt-get install -y nodejs \ + && npm install -g bower \ + && npm install -g grunt \ + && npm install -g grunt-cli WORKDIR ${working_dir} +RUN python setup.py install RUN docker/reporting.sh +RUN docker/web_server.sh expose 8000 diff --git a/utils/test/reporting/docker/nginx.conf b/utils/test/reporting/docker/nginx.conf index 9e2697248..ced8179c1 100644 --- a/utils/test/reporting/docker/nginx.conf +++ b/utils/test/reporting/docker/nginx.conf @@ -15,10 +15,10 @@ server { } location /reporting/ { - alias /home/opnfv/utils/test/reporting/pages/dist/; + alias /home/opnfv/releng/utils/test/reporting/pages/dist/; } location /display/ { - alias /home/opnfv/utils/test/reporting/display/; + alias /home/opnfv/releng/utils/test/reporting/display/; } } diff --git a/utils/test/reporting/docker/reporting.sh b/utils/test/reporting/docker/reporting.sh index 49f4517f7..076dc4719 100755 --- a/utils/test/reporting/docker/reporting.sh +++ b/utils/test/reporting/docker/reporting.sh @@ -1,10 +1,10 @@ #!/bin/bash -export PYTHONPATH="${PYTHONPATH}:." -export CONFIG_REPORTING_YAML=./reporting.yaml +export PYTHONPATH="${PYTHONPATH}:./reporting" +export CONFIG_REPORTING_YAML=./reporting/reporting.yaml declare -a versions=(danube master) -declare -a projects=(functest storperf yardstick) +declare -a projects=(functest storperf yardstick qtip) project=$1 reporting_type=$2 @@ -29,8 +29,9 @@ cp -Rf js display # projet | option # $1 | $2 # functest | status, vims, tempest -# yardstick | -# storperf | +# yardstick | status +# storperf | status +# qtip | status function report_project() { @@ -40,7 +41,7 @@ function report_project() echo "********************************" echo " $project reporting " echo "********************************" - python ./$dir/reporting-$type.py + python ./reporting/$dir/reporting-$type.py if [ $? ]; then echo "$project reporting $type...OK" else @@ -50,51 +51,28 @@ function report_project() if [ -z "$1" ]; then echo "********************************" - echo " Functest reporting " + echo " * Static status reporting *" echo "********************************" - echo "reporting vIMS..." - python ./functest/reporting-vims.py - echo "reporting vIMS...OK" - sleep 10 - echo "reporting Tempest..." - python ./functest/reporting-tempest.py - echo "reporting Tempest...OK" - sleep 10 - echo "reporting status..." - python ./functest/reporting-status.py - echo "Functest reporting status...OK" - - echo "********************************" - echo " Yardstick reporting " - echo "********************************" - python ./yardstick/reporting-status.py - echo "Yardstick reporting status...OK" + for i in "${projects[@]}" + do + report_project $i $i "status" + sleep 5 + done + report_project "QTIP" "qtip" "status" - echo "********************************" - echo " Storperf reporting " - echo "********************************" - python ./storperf/reporting-status.py - echo "Storperf reporting status...OK" - report_project "QTIP" "qtip" "status" + echo "Functest reporting vIMS..." + report_project "functest" "functest" "vims" + echo "reporting vIMS...OK" + sleep 5 + echo "Functest reporting Tempest..." + report_project "functest" "functest" "tempest" + echo "reporting Tempest...OK" + sleep 5 else if [ -z "$2" ]; then reporting_type="status" fi - echo "********************************" - echo " $project/$reporting_type reporting " - echo "********************************" - python ./$project/reporting-$reporting_type.py + report_project $project $project $reporting_type fi -cp -r display /usr/share/nginx/html - - -# nginx config -cp /home/opnfv/utils/test/reporting/docker/nginx.conf /etc/nginx/conf.d/ -echo "daemon off;" >> /etc/nginx/nginx.conf - -# supervisor config -cp /home/opnfv/utils/test/reporting/docker/supervisor.conf /etc/supervisor/conf.d/ - -ln -s /usr/bin/nodejs /usr/bin/node diff --git a/utils/test/reporting/docker/requirements.pip b/utils/test/reporting/docker/requirements.pip index 6de856e35..aeee3ba96 100644 --- a/utils/test/reporting/docker/requirements.pip +++ b/utils/test/reporting/docker/requirements.pip @@ -12,3 +12,4 @@ PyYAML==3.11 simplejson==3.8.1 jinja2==2.8 tornado==4.4.2 +requests==2.12.5 diff --git a/utils/test/reporting/docker/supervisor.conf b/utils/test/reporting/docker/supervisor.conf index 5e315babe..49310d430 100644 --- a/utils/test/reporting/docker/supervisor.conf +++ b/utils/test/reporting/docker/supervisor.conf @@ -1,22 +1,19 @@ [supervisord] nodaemon = true -[program:reporting_tornado] +[program:tornado] user = root -directory = /home/opnfv/utils/test/reporting/api/api +directory = /home/opnfv/releng/utils/test/reporting/api command = python server.py --port=800%(process_num)d process_name=%(program_name)s%(process_num)d numprocs=4 numprocs_start=1 -autorestart = true -[program:reporting_nginx] +[program:nginx] user = root command = service nginx restart -autorestart = true -[program:reporting_angular] +[program:configuration] user = root -directory = /home/opnfv/utils/test/reporting/pages -command = bash angular.sh -autorestart = true +directory = /home/opnfv/releng/utils/test/reporting/pages +command = bash config.sh diff --git a/utils/test/reporting/docker/web_server.sh b/utils/test/reporting/docker/web_server.sh new file mode 100755 index 000000000..0dd8df73d --- /dev/null +++ b/utils/test/reporting/docker/web_server.sh @@ -0,0 +1,14 @@ +#!/bin/bash +cp -r display /usr/share/nginx/html + + +# nginx config +cp /home/opnfv/releng/utils/test/reporting/docker/nginx.conf /etc/nginx/conf.d/ +echo "daemon off;" >> /etc/nginx/nginx.conf + +# supervisor config +cp /home/opnfv/releng/utils/test/reporting/docker/supervisor.conf /etc/supervisor/conf.d/ + +# Manage Angular front end +cd pages && /bin/bash angular.sh + diff --git a/utils/test/reporting/docs/_build/.buildinfo b/utils/test/reporting/docs/_build/.buildinfo new file mode 100644 index 000000000..6bd6fd634 --- /dev/null +++ b/utils/test/reporting/docs/_build/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 235ce07a48cec983846ad34dfd375b07 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/utils/test/reporting/docs/_build/.doctrees/environment.pickle b/utils/test/reporting/docs/_build/.doctrees/environment.pickle Binary files differnew file mode 100644 index 000000000..23f59c377 --- /dev/null +++ b/utils/test/reporting/docs/_build/.doctrees/environment.pickle diff --git a/utils/test/reporting/docs/_build/.doctrees/index.doctree b/utils/test/reporting/docs/_build/.doctrees/index.doctree Binary files differnew file mode 100644 index 000000000..51e2d5ad3 --- /dev/null +++ b/utils/test/reporting/docs/_build/.doctrees/index.doctree diff --git a/utils/test/reporting/docs/conf.py b/utils/test/reporting/docs/conf.py new file mode 100644 index 000000000..2e70d2b63 --- /dev/null +++ b/utils/test/reporting/docs/conf.py @@ -0,0 +1,341 @@ +# -*- coding: utf-8 -*- +# +# OPNFV testing Reporting documentation build configuration file, created by +# sphinx-quickstart on Mon July 4 10:03:43 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The encoding of source files. +# +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'OPNFV Reporting' +copyright = u'2017, #opnfv-testperf (chat.freenode.net)' +author = u'#opnfv-testperf (chat.freenode.net)' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'master' +# The full version, including alpha/beta/rc tags. +release = u'master' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = 'en' + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# +# today = '' +# +# Else, today_fmt is used as the format for a strftime call. +# +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. +# "<project> v<release> documentation" by default. +# +# html_title = u'OPNFV Functest vmaster' + +# A shorter title for the navigation bar. Default is the same as html_title. +# +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# +# html_logo = None + +# The name of an image file (relative to this directory) to use as a favicon of +# the docs. This file should be a Windows icon file (.ico) being 16x16 or +# 32x32 pixels large. +# +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# +# html_extra_path = [] + +# If not None, a 'Last updated on:' timestamp is inserted at every page +# bottom, using the given strftime format. +# The empty string is equivalent to '%b %d, %Y'. +# +# html_last_updated_fmt = None + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# +# html_additional_pages = {} + +# If false, no module index is generated. +# +# html_domain_indices = True + +# If false, no index is generated. +# +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' +# +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# 'ja' uses this config value. +# 'zh' user can custom change `jieba` dictionary path. +# +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'OPNFVreportingdoc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'OPNFVReporting.tex', + u'OPNFV testing Reporting Documentation', + u'\\#opnfv-testperf (chat.freenode.net)', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# +# latex_use_parts = False + +# If true, show page references after internal links. +# +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# +# latex_appendices = [] + +# It false, will not define \strong, \code, itleref, \crossref ... but only +# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added +# packages. +# +# latex_keep_old_macro_names = True + +# If false, no module index is generated. +# +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'opnfvReporting', u'OPNFV Testing Reporting Documentation', + [author], 1) +] + +# If true, show URL addresses after external links. +# +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'OPNFVReporting', u'OPNFV Testing reporting Documentation', + author, 'OPNFVTesting', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +# +# texinfo_appendices = [] + +# If false, no module index is generated. +# +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# +# texinfo_no_detailmenu = False diff --git a/utils/test/reporting/docs/index.rst b/utils/test/reporting/docs/index.rst new file mode 100644 index 000000000..af4187672 --- /dev/null +++ b/utils/test/reporting/docs/index.rst @@ -0,0 +1,16 @@ +Welcome to OPNFV Testing reporting documentation! +================================================= + +Contents: + +.. toctree:: + :maxdepth: 2 + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/utils/test/reporting/pages/angular.sh b/utils/test/reporting/pages/angular.sh index 080f27bb7..0e00ea635 100755 --- a/utils/test/reporting/pages/angular.sh +++ b/utils/test/reporting/pages/angular.sh @@ -1,8 +1,3 @@ -: ${SERVER_URL:='http://testresults.opnfv.org/reporting/api'} - -echo "var BASE_URL = 'http://${SERVER_URL}/landing-page'" >> app/scripts/app.config.js -echo "var PROJECT_URL = 'http://${SERVER_URL}'" >> app/scripts/app.config.js - apt-get install -y nodejs apt-get install -y npm npm install diff --git a/utils/test/reporting/pages/app/index.html b/utils/test/reporting/pages/app/index.html index f4eb65adf..843a6230e 100644 --- a/utils/test/reporting/pages/app/index.html +++ b/utils/test/reporting/pages/app/index.html @@ -87,10 +87,9 @@ <script src="scripts/controllers/auth.controller.js"></script> <script src="scripts/controllers/admin.controller.js"></script> <script src="scripts/controllers/main.controller.js"></script> - <script src="scripts/app.config.js"></script> <script src="scripts/controllers/testvisual.controller.js"></script> <!-- endbuild --> </body> -</html>
\ No newline at end of file +</html> diff --git a/utils/test/reporting/pages/app/scripts/controllers/table.controller.js b/utils/test/reporting/pages/app/scripts/controllers/table.controller.js index 0f3a17a03..8d494c3ae 100644 --- a/utils/test/reporting/pages/app/scripts/controllers/table.controller.js +++ b/utils/test/reporting/pages/app/scripts/controllers/table.controller.js @@ -8,378 +8,271 @@ * Controller of the opnfvdashBoardAngularApp */ angular.module('opnfvApp') - .controller('TableController', ['$scope', '$state', '$stateParams', '$http', 'TableFactory', function($scope, $state, $stateParams, $http, TableFactory) { - - $scope.filterlist = []; - $scope.selection = []; - $scope.statusList = []; - $scope.projectList = []; - $scope.installerList = []; - $scope.versionlist = []; - $scope.loopci = []; - $scope.time = []; - $scope.tableDataAll = {}; - $scope.tableInfoAll = {}; - $scope.scenario = {}; - - $scope.VersionConfig = { - create: true, - valueField: 'title', - labelField: 'title', - delimiter: '|', - maxItems: 1, - placeholder: 'Version', - onChange: function(value) { - checkElementArrayValue($scope.selection, $scope.VersionOption); - $scope.selection.push(value); - // console.log($scope.selection); - getScenarioData(); - - } - } - - $scope.LoopConfig = { - create: true, - valueField: 'title', - labelField: 'title', - delimiter: '|', - maxItems: 1, - placeholder: 'Loop', - onChange: function(value) { - checkElementArrayValue($scope.selection, $scope.LoopOption); - $scope.selection.push(value); - // console.log($scope.selection); - getScenarioData(); - - } - } - - $scope.TimeConfig = { - create: true, - valueField: 'title', - labelField: 'title', - delimiter: '|', - maxItems: 1, - placeholder: 'Time', - onChange: function(value) { - checkElementArrayValue($scope.selection, $scope.TimeOption); - $scope.selection.push(value); - // console.log($scope.selection) - getScenarioData(); - + .controller('TableController', ['$scope', '$state', '$stateParams', '$http', 'TableFactory', '$timeout', + function($scope, $state, $stateParams, $http, TableFactory, $timeout) { + + init(); + + function init() { + $scope.filterlist = []; + $scope.selection = []; + + $scope.statusList = []; + $scope.projectList = []; + $scope.installerList = []; + $scope.versionlist = []; + $scope.loopList = []; + $scope.timeList = []; + + $scope.selectStatus = []; + $scope.selectProjects = []; + $scope.selectInstallers = []; + $scope.selectVersion = null; + $scope.selectLoop = null; + $scope.selectTime = null; + + $scope.statusClicked = false; + $scope.installerClicked = false; + $scope.projectClicked = false; + + $scope.scenarios = {}; + + $scope.VersionConfig = { + create: true, + valueField: 'title', + labelField: 'title', + delimiter: '|', + maxItems: 1, + placeholder: 'Version', + onChange: function(value) { + $scope.selectVersion = value; + + getScenarioData(); - } - } - - - init(); - - function init() { - $scope.toggleSelection = toggleSelection; - getScenarioData(); - // radioSetting(); - getFilters(); - } - - function getFilters() { - TableFactory.getFilter().get({ - - - }).$promise.then(function(response) { - if (response != null) { - $scope.statusList = response.filters.status; - $scope.projectList = response.filters.projects; - $scope.installerList = response.filters.installers; - $scope.versionlist = response.filters.version; - $scope.loopci = response.filters.loops; - $scope.time = response.filters.time; - - $scope.statusListString = $scope.statusList.toString(); - $scope.projectListString = $scope.projectList.toString(); - $scope.installerListString = $scope.installerList.toString(); - $scope.VersionSelected = $scope.versionlist[1]; - $scope.LoopCiSelected = $scope.loopci[0]; - $scope.TimeSelected = $scope.time[0]; - radioSetting($scope.versionlist, $scope.loopci, $scope.time); - - } else { - alert("网络错误"); - } - }) - } - - function getScenarioData() { - - var utl = BASE_URL + '/scenarios'; - var data = { - 'status': ['success', 'danger', 'warning'], - 'projects': ['functest', 'yardstick'], - 'installers': ['apex', 'compass', 'fuel', 'joid'], - 'version': $scope.VersionSelected, - 'loops': $scope.LoopCiSelected, - 'time': $scope.TimeSelected - }; - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' - } - } - $http.post(utl, data, config).then(function(response) { - if (response.status == 200) { - $scope.scenario = response.data; - constructJson(); - } - }) - } - - //construct json - function constructJson() { - - var colspan; - var InstallerData; - var projectsInfo; - $scope.tableDataAll["scenario"] = []; - - - for (var item in $scope.scenario.scenarios) { - - var headData = Object.keys($scope.scenario.scenarios[item].installers).sort(); - var scenarioStatus = $scope.scenario.scenarios[item].status; - var scenarioStatusDisplay; - if (scenarioStatus == "success") { - scenarioStatusDisplay = "navy"; - } else if (scenarioStatus == "danger") { - scenarioStatusDisplay = "danger"; - } else if (scenarioStatus == "warning") { - scenarioStatusDisplay = "warning"; + } } - InstallerData = headData; - var projectData = []; - var datadisplay = []; - var projects = []; + $scope.LoopConfig = { + create: true, + valueField: 'title', + labelField: 'title', + delimiter: '|', + maxItems: 1, + placeholder: 'Loop', + onChange: function(value) { + $scope.selectLoop = value; - for (var j = 0; j < headData.length; j++) { + getScenarioData(); - projectData.push($scope.scenario.scenarios[item].installers[headData[j]]); + } } - for (var j = 0; j < projectData.length; j++) { - - for (var k = 0; k < projectData[j].length; k++) { - projects.push(projectData[j][k].project); - var temArray = []; - if (projectData[j][k].score == null) { - temArray.push("null"); - temArray.push(projectData[j][k].project); - temArray.push(headData[j]); - } else { - temArray.push(projectData[j][k].score); - temArray.push(projectData[j][k].project); - temArray.push(headData[j]); - } - - - if (projectData[j][k].status == "platinium") { - temArray.push("primary"); - temArray.push("P"); - } else if (projectData[j][k].status == "gold") { - temArray.push("danger"); - temArray.push("G"); - } else if (projectData[j][k].status == "silver") { - temArray.push("warning"); - temArray.push("S"); - } else if (projectData[j][k].status == null) { - temArray.push("null"); - } - - datadisplay.push(temArray); + $scope.TimeConfig = { + create: true, + valueField: 'title', + labelField: 'title', + delimiter: '|', + maxItems: 1, + placeholder: 'Time', + onChange: function(value) { + $scope.selectTime = value; + + getScenarioData(); } - } - colspan = projects.length / headData.length; - - var tabledata = { - scenarioName: item, - Installer: InstallerData, - projectData: projectData, - projects: projects, - datadisplay: datadisplay, - colspan: colspan, - status: scenarioStatus, - statusDisplay: scenarioStatusDisplay - }; - - JSON.stringify(tabledata); - $scope.tableDataAll.scenario.push(tabledata); - - // console.log(tabledata); - + getFilters(); } + function getFilters() { + TableFactory.getFilter().get({ + }).$promise.then(function(response) { + if (response != null) { + $scope.statusList = response.filters.status; + $scope.projectList = response.filters.projects; + $scope.installerList = response.filters.installers; + $scope.versionList = toSelectList(response.filters.version); + $scope.loopList = toSelectList(response.filters.loops); + $scope.timeList = toSelectList(response.filters.time); + + $scope.selectStatus = copy($scope.statusList); + $scope.selectInstallers = copy($scope.installerList); + $scope.selectProjects = copy($scope.projectList); + $scope.selectVersion = response.filters.version[0]; + $scope.selectLoop = response.filters.loops[0]; + $scope.selectTime = response.filters.time[0]; + + getScenarioData(); + + } else { + } + }); + } - projectsInfo = $scope.tableDataAll.scenario[0].projects; - - var tempHeadData = []; - - for (var i = 0; i < InstallerData.length; i++) { - for (var j = 0; j < colspan; j++) { - tempHeadData.push(InstallerData[i]); - } + function toSelectList(arr){ + var tempList = []; + angular.forEach(arr, function(ele){ + tempList.push({'title': ele}); + }); + return tempList; } - //console.log(tempHeadData); + function copy(arr){ + var tempList = []; + angular.forEach(arr, function(ele){ + tempList.push(ele); + }); + return tempList; + } - var projectsInfoAll = []; + function getScenarioData() { - for (var i = 0; i < projectsInfo.length; i++) { - var tempA = []; - tempA.push(projectsInfo[i]); - tempA.push(tempHeadData[i]); - projectsInfoAll.push(tempA); + var data = { + 'status': $scope.selectStatus, + 'projects': $scope.selectProjects, + 'installers': $scope.selectInstallers, + 'version': $scope.selectVersion, + 'loops': $scope.selectLoop, + 'time': $scope.selectTime + }; - } - //console.log(projectsInfoAll); + TableFactory.getScenario(data).then(function(response) { + if (response.status == 200) { + $scope.scenarios = response.data.scenarios; + getScenario(); + } - $scope.tableDataAll["colspan"] = colspan; - $scope.tableDataAll["Installer"] = InstallerData; - $scope.tableDataAll["Projects"] = projectsInfoAll; + }, function(error) { + }); - // console.log($scope.tableDataAll); - $scope.colspan = $scope.tableDataAll.colspan; + } - } + function getScenario(){ - //get json element size - function getSize(jsondata) { - var size = 0; - for (var item in jsondata) { - size++; + $scope.project_row = []; + angular.forEach($scope.selectInstallers, function(installer){ + angular.forEach($scope.selectProjects, function(project){ + var temp = { + 'installer': installer, + 'project': project + } + $scope.project_row.push(temp); + + }); + }); + + + $scope.scenario_rows = []; + angular.forEach($scope.scenarios, function(scenario, name){ + var scenario_row = { + 'name': null, + 'status': null, + 'statusDisplay': null, + 'datadisplay': [], + }; + scenario_row.name = name; + scenario_row.status = scenario.status; + + var scenarioStatusDisplay; + if (scenario.status == "success") { + scenarioStatusDisplay = "navy"; + } else if (scenario.status == "danger") { + scenarioStatusDisplay = "danger"; + } else if (scenario.status == "warning") { + scenarioStatusDisplay = "warning"; + } + scenario_row.statusDisplay = scenarioStatusDisplay; + + angular.forEach($scope.selectInstallers, function(installer){ + angular.forEach($scope.selectProjects, function(project){ + var datadisplay = { + 'installer': null, + 'project': null, + 'value': null, + 'label': null, + 'label_value': null + }; + datadisplay.installer = installer; + datadisplay.project = project; + datadisplay.value = scenario.installers[installer][project].score; + + var single_status = scenario.installers[installer][project].status; + if (single_status == "platinium") { + datadisplay.label = 'primary'; + datadisplay.label_value = 'P'; + } else if (single_status == "gold") { + datadisplay.label = 'danger'; + datadisplay.label_value = 'G'; + } else if (single_status == "silver") { + datadisplay.label = 'warning'; + datadisplay.label_value = 'S'; + } else if (single_status == null) { + } + scenario_row.datadisplay.push(datadisplay); + + }); + }); + $scope.scenario_rows.push(scenario_row); + }); } - return size; - } - $scope.colspan = $scope.tableDataAll.colspan; - // console.log($scope.colspan); - - //find all same element index - function getSameElementIndex(array, element) { - var indices = []; - var idx = array.indexOf(element); - while (idx != -1) { - indices.push(idx); - idx = array.indexOf(element, idx + 1); + function clickBase(eleList, ele){ + var idx = eleList.indexOf(ele); + if(idx > -1){ + eleList.splice(idx, 1); + }else{ + eleList.push(ele); + } } - //return indices; - var result = { element: element, index: indices }; - JSON.stringify(result); - return result; - } - //delete element in array - function deletElement(array, index) { - array.splice(index, 1); + $scope.clickStatus = function(status){ + if($scope.selectStatus.length == $scope.statusList.length && $scope.statusClicked == false){ + $scope.selectStatus = []; + $scope.statusClicked = true; + } - } + clickBase($scope.selectStatus, status); - function radioSetting(array1, array2, array3) { - var tempVersion = []; - var tempLoop = []; - var tempTime = []; - for (var i = 0; i < array1.length; i++) { - var temp = { - title: array1[i] - }; - tempVersion.push(temp); - } - for (var i = 0; i < array2.length; i++) { - var temp = { - title: array2[i] - }; - tempLoop.push(temp); - } - for (var i = 0; i < array3.length; i++) { - var temp = { - title: array3[i] - }; - tempTime.push(temp); - } - $scope.VersionOption = tempVersion; - $scope.LoopOption = tempLoop; - $scope.TimeOption = tempTime; - } - - //remove element in the array - function removeArrayValue(arr, value) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] == value) { - arr.splice(i, 1); - break; + if($scope.selectStatus.length == 0 && $scope.statusClicked == true){ + $scope.selectStatus = copy($scope.statusList); + $scope.statusClicked = false; } + + getScenarioData(); } - } - //check if exist element - function checkElementArrayValue(arrayA, arrayB) { - for (var i = 0; i < arrayB.length; i++) { - if (arrayA.indexOf(arrayB[i].title) > -1) { - removeArrayValue(arrayA, arrayB[i].title); + $scope.clickInstaller = function(installer){ + if($scope.selectInstallers.length == $scope.installerList.length && $scope.installerClicked == false){ + $scope.selectInstallers = []; + $scope.installerClicked = true; } - } - } - function toggleSelection(status) { - var idx = $scope.selection.indexOf(status); + clickBase($scope.selectInstallers, installer); + + if($scope.selectInstallers.length == 0 && $scope.installerClicked == true){ + $scope.selectInstallers = copy($scope.installerList); + $scope.installerClicked = false; + } - if (idx > -1) { - $scope.selection.splice(idx, 1); - filterData($scope.selection) - } else { - $scope.selection.push(status); - filterData($scope.selection) + getScenarioData(); } - // console.log($scope.selection); - } + $scope.clickProject = function(project){ + if($scope.selectProjects.length == $scope.projectList.length && $scope.projectClicked == false){ + $scope.selectProjects = []; + $scope.projectClicked = true; + } - //filter function - function filterData(selection) { + clickBase($scope.selectProjects, project); - $scope.selectInstallers = []; - $scope.selectProjects = []; - $scope.selectStatus = []; - for (var i = 0; i < selection.length; i++) { - if ($scope.statusListString.indexOf(selection[i]) > -1) { - $scope.selectStatus.push(selection[i]); - } - if ($scope.projectListString.indexOf(selection[i]) > -1) { - $scope.selectProjects.push(selection[i]); - } - if ($scope.installerListString.indexOf(selection[i]) > -1) { - $scope.selectInstallers.push(selection[i]); + if($scope.selectProjects.length == 0 && $scope.projectClicked == true){ + $scope.selectProjects = copy($scope.projectList); + $scope.projectClicked = false; } - } - - $scope.colspan = $scope.selectProjects.length; - //when some selection is empty, we set it full - if ($scope.selectInstallers.length == 0) { - $scope.selectInstallers = $scope.installerList; + getScenarioData(); } - if ($scope.selectProjects.length == 0) { - $scope.selectProjects = $scope.projectList; - $scope.colspan = $scope.tableDataAll.colspan; - } - if ($scope.selectStatus.length == 0) { - $scope.selectStatus = $scope.statusList - } - - // console.log($scope.selectStatus); - // console.log($scope.selectProjects); } - - - }]);
\ No newline at end of file + ]); diff --git a/utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js b/utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js index def8e7293..894e10f77 100644 --- a/utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js +++ b/utils/test/reporting/pages/app/scripts/controllers/testvisual.controller.js @@ -16,7 +16,7 @@ angular.module('opnfvApp') $scope.vsperf = "542,185,640,414"; $scope.stor = "658,187,750,410"; $scope.qtip = "769,190,852,416"; - $scope.bootleneck = "870,192,983,419"; + $scope.bottlenecks = "870,192,983,419"; $scope.noPopArea1 = "26,8,1190,180"; $scope.noPopArea2 = "1018,193,1190,590"; $scope.noPopArea3 = "37,455,1003,584"; @@ -41,25 +41,18 @@ angular.module('opnfvApp') $scope.tableData = null; $scope.modalName = name; - var url = PROJECT_URL + '/projects/' + name + '/cases'; - - var config = { - headers: { - 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' - } - } - $http.get(url, config).then(function(response) { + TableFactory.getProjectTestCases(name).then(function(response) { if (response.status == 200) { $scope.tableData = response.data; $scope.tableData = constructObjectArray($scope.tableData); console.log($scope.tableData); $loading.finish('Key'); - - - } + }, function(error) { + }) + } //construct key value for tableData diff --git a/utils/test/reporting/pages/app/scripts/factory/table.factory.js b/utils/test/reporting/pages/app/scripts/factory/table.factory.js index 2a8cbd046..e715c5c28 100644 --- a/utils/test/reporting/pages/app/scripts/factory/table.factory.js +++ b/utils/test/reporting/pages/app/scripts/factory/table.factory.js @@ -4,45 +4,67 @@ * get data factory */ angular.module('opnfvApp') - .factory('TableFactory', function($resource, $rootScope) { + .factory('TableFactory', function($resource, $rootScope, $http) { + + var BASE_URL = 'http://testresults.opnfv.org/reporting2'; + $.ajax({ + url: 'config.json', + async: false, + dataType: 'json', + success: function (response) { + BASE_URL = response.url; + }, + error: function (response){ + alert('fail to get api url, using default: http://testresults.opnfv.org/reporting2') + } + }); return { getFilter: function() { - return $resource(BASE_URL + '/filters', {}, { + return $resource(BASE_URL + '/landing-page/filters', {}, { 'get': { method: 'GET', } }); }, - getScenario: function() { - return $resource(BASE_URL + '/scenarios', {}, { - 'post': { - method: 'POST', + getScenario: function(data) { + + var config = { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' } - }) + } + + return $http.post(BASE_URL + '/landing-page/scenarios', data, config); }, + + getProjectUrl: function() { - return $resource(PROJECT_URL + '/projects-page/projects', {}, { + return $resource(BASE_URL + '/projects-page/projects', {}, { 'get': { method: 'GET' } }) }, - getProjectTestCases: function() { - return $resource(PROJECT_URL + '/projects/:project/cases', { project: '@project' }, { - 'get': { - method: 'GET' + getProjectTestCases: function(name) { + var config = { + headers: { + 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' } - }) + }; + return $http.get(BASE_URL + '/projects/' + name + '/cases', {}, config) + + }, getProjectTestCaseDetail: function() { - return $resource(PROJECT_URL + '/projects/:project/cases/:testcase', { project: '@project', testcase: '@testcase' }, { + return $resource(BASE_URL + '/projects/:project/cases/:testcase', { project: '@project', testcase: '@testcase' }, { 'get': { method: 'GET' } }) } + }; - });
\ No newline at end of file + }); diff --git a/utils/test/reporting/pages/app/views/commons/table.html b/utils/test/reporting/pages/app/views/commons/table.html index f504bd76b..a33c48312 100644 --- a/utils/test/reporting/pages/app/views/commons/table.html +++ b/utils/test/reporting/pages/app/views/commons/table.html @@ -29,9 +29,9 @@ <div class=" col-md-12" data-toggle="buttons" aria-pressed="false"> <label> Status </label> - <label class="btn btn-outline btn-success btn-sm" style="height:25px; margin-right: 5px;" ng-repeat="status in statusList" value={{status}} ng-checked="selection.indexOf(status)>-1" ng-click="toggleSelection(status)"> + <label class="btn btn-outline btn-success btn-sm" style="height:25px; margin-right: 5px;" ng-repeat="status in statusList" value={{status}} ng-checked="selectStatus.indexOf(status)>-1" ng-click="clickStatus(status)"> <input type="checkbox" disabled="disabled" > {{status}} - + </label> </div> @@ -39,7 +39,7 @@ <div class=" col-md-12" data-toggle="buttons"> <label> Projects </label> - <label class="btn btn-outline btn-success btn-sm " style="height:25px;margin-right: 5px;" ng-repeat="project in projectList" value={{project}} ng-checked="selection.indexOf(project)>-1" ng-click="toggleSelection(project)"> + <label class="btn btn-outline btn-success btn-sm " style="height:25px;margin-right: 5px;" ng-repeat="project in projectList" value={{project}} ng-checked="selectProjects.indexOf(project)>-1" ng-click="clickProject(project)"> <input type="checkbox" disabled="disabled"> {{project}} </label> @@ -47,7 +47,7 @@ <hr class="myhr"> <div class=" col-md-12" data-toggle="buttons"> <label> Installers </label> - <label class="btn btn-outline btn-success btn-sm" style="height:25px;margin-right: 5px;" ng-repeat="installer in installerList" value={{installer}} ng-checked="selection.indexOf(installer)>-1" ng-click="toggleSelection(installer)"> + <label class="btn btn-outline btn-success btn-sm" style="height:25px;margin-right: 5px;" ng-repeat="installer in installerList" value={{installer}} ng-checked="selectInstallers.indexOf(installer)>-1" ng-click="clickInstaller(installer)"> <input type="checkbox" disabled="disabled"> {{installer}} </label> </div> @@ -56,17 +56,17 @@ <div class=" col-md-1" style="margin-top:5px;margin-right: 5px;"> - <selectize options="VersionOption" ng-model="VersionSelected" config="VersionConfig"></selectize> + <selectize options="versionList" ng-model="selectVersion" config="VersionConfig"></selectize> </div> <div class=" col-md-1" style="margin-top:5px;margin-right: 5px;"> - <selectize options="LoopOption" ng-model="LoopCiSelected" config="LoopConfig"></selectize> + <selectize options="loopList" ng-model="selectLoop" config="LoopConfig"></selectize> </div> <div class=" col-md-1" style="margin-top:5px;margin-right: 5px;"> - <selectize options="TimeOption" ng-model="TimeSelected" config="TimeConfig"></selectize> + <selectize options="timeList" ng-model="selectTime" config="TimeConfig"></selectize> </div> </div> <div class="table-responsive"> @@ -75,25 +75,25 @@ <thead class="thead"> <tr> <th>Scenario </th> - <th colspan={{colspan}} ng-show="selectInstallers.indexOf(key)!=-1" value={{key}} ng-repeat="key in tableDataAll.Installer"><a href="notfound.html">{{key}}</a> </th> + <th colspan={{selectProjects.length}} ng-show="selectInstallers.indexOf(key)!=-1" value={{key}} ng-repeat="key in selectInstallers"><a href="notfound.html">{{key}}</a> </th> </tr> <tr> <td></td> - <td ng-show="selectProjects.indexOf(project[0])!=-1 && selectInstallers.indexOf(project[1])!=-1" ng-repeat="project in tableDataAll.Projects track by $index" data={{project[1]}} value={{project[0]}}>{{project[0]}}</td> + <td ng-show="selectProjects.indexOf(project.project)!=-1 && selectInstallers.indexOf(project.installer)!=-1" ng-repeat="project in project_row track by $index" data={{project.installer}} value={{project.project}}>{{ project.project }}</td> </tr> </thead> <tbody class="tbody"> - <tr ng-repeat="scenario in tableDataAll.scenario" ng-show="selectStatus.indexOf(scenario.status)!=-1"> + <tr ng-repeat="scenario in scenario_rows" ng-show="selectStatus.indexOf(scenario.status)!=-1"> - <td nowrap="nowrap" data={{scenario.status}}><span class="fa fa-circle text-{{scenario.statusDisplay}}"></span> <a href="notfound.html">{{scenario.scenarioName}}</a> </td> + <td nowrap="nowrap" data={{scenario.status}}><span class="fa fa-circle text-{{scenario.statusDisplay}}"></span> <a href="notfound.html">{{scenario.name}}</a> </td> <!--<td style="background-color:#e7eaec" align="justify" ng-if="data[0]=='Not Support'" ng-repeat="data in scenario.datadisplay track by $index" data={{data[1]}} value={{data[2]}}></td>--> - <td nowrap="nowrap" ng-show="selectInstallers.indexOf(data[2])!=-1 && selectProjects.indexOf(data[1])!=-1" ng-repeat="data in scenario.datadisplay track by $index" data={{data[1]}} value={{data[2]}} class={{data[0]}}> - <span class="label label-{{data[3]}}">{{data[4]}}</a></span> {{data[0]}}</td> + <td nowrap="nowrap" ng-show="selectInstallers.indexOf(data.installer)!=-1 && selectProjects.indexOf(data.project)!=-1" ng-repeat="data in scenario.datadisplay track by $index" data={{data.project}} value={{data.installer}} class={{data.value}}> + <span class="label label-{{data.label}}">{{data.label_value}}</a></span> {{data.value}}</td> </tr> @@ -110,4 +110,4 @@ </div> </div> -</section>
\ No newline at end of file +</section> diff --git a/utils/test/reporting/pages/app/views/commons/testCaseVisual.html b/utils/test/reporting/pages/app/views/commons/testCaseVisual.html index 74eb56eba..4de4e187f 100644 --- a/utils/test/reporting/pages/app/views/commons/testCaseVisual.html +++ b/utils/test/reporting/pages/app/views/commons/testCaseVisual.html @@ -20,7 +20,7 @@ <area shape="rect" coords={{vsperf}} alt="test" href="{{vsperfurl}}" onmouseover="pop(event)" ng-mouseover="myTrigger('vsperf')" /> <area shape="rect" coords={{stor}} alt="test" href="{{storperfurl}}" onmouseover="pop(event)" ng-mouseover="myTrigger('storperf')"/> <area shape="rect" coords={{qtip}} alt="test" href="{{qtipurl}}" onmouseover="pop(event)" ng-mouseover="myTrigger('qtip')" /> - <area shape="rect" coords={{bootleneck}} alt="test" href="{{bottlenecksurl}}" onmouseover="pop(event)" ng-mouseover="myTrigger('bootlenecks')" /> + <area shape="rect" coords={{bottlenecks}} alt="test" href="{{bottlenecksurl}}" onmouseover="pop(event)" ng-mouseover="myTrigger('bottlenecks')" /> <area shape="rect" coords={{noPopArea1}} alt="test" onmouseover="pophide(event)" /> <area shape="rect" coords={{noPopArea2}} alt="test" onmouseover="pophide(event)" /> <area shape="rect" coords={{noPopArea3}} alt="test" onmouseover="pophide(event)" /> @@ -124,4 +124,4 @@ $('#popup').hide(); return true; } - </script>
\ No newline at end of file + </script> diff --git a/utils/test/reporting/pages/config.sh b/utils/test/reporting/pages/config.sh new file mode 100755 index 000000000..f9bb89ac8 --- /dev/null +++ b/utils/test/reporting/pages/config.sh @@ -0,0 +1,3 @@ +: ${SERVER_URL:='testresults.opnfv.org/reporting2'} + +echo "{\"url\": \"http://${SERVER_URL}\"}" > dist/config.json diff --git a/utils/test/reporting/functest/__init__.py b/utils/test/reporting/reporting/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/reporting/functest/__init__.py +++ b/utils/test/reporting/reporting/__init__.py diff --git a/utils/test/reporting/qtip/__init__.py b/utils/test/reporting/reporting/functest/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/reporting/qtip/__init__.py +++ b/utils/test/reporting/reporting/functest/__init__.py diff --git a/utils/test/reporting/functest/img/gauge_0.png b/utils/test/reporting/reporting/functest/img/gauge_0.png Binary files differindex ecefc0e66..ecefc0e66 100644 --- a/utils/test/reporting/functest/img/gauge_0.png +++ b/utils/test/reporting/reporting/functest/img/gauge_0.png diff --git a/utils/test/reporting/functest/img/gauge_100.png b/utils/test/reporting/reporting/functest/img/gauge_100.png Binary files differindex e199e1561..e199e1561 100644 --- a/utils/test/reporting/functest/img/gauge_100.png +++ b/utils/test/reporting/reporting/functest/img/gauge_100.png diff --git a/utils/test/reporting/functest/img/gauge_16.7.png b/utils/test/reporting/reporting/functest/img/gauge_16.7.png Binary files differindex 3e3993c3b..3e3993c3b 100644 --- a/utils/test/reporting/functest/img/gauge_16.7.png +++ b/utils/test/reporting/reporting/functest/img/gauge_16.7.png diff --git a/utils/test/reporting/functest/img/gauge_25.png b/utils/test/reporting/reporting/functest/img/gauge_25.png Binary files differindex 4923659b9..4923659b9 100644 --- a/utils/test/reporting/functest/img/gauge_25.png +++ b/utils/test/reporting/reporting/functest/img/gauge_25.png diff --git a/utils/test/reporting/functest/img/gauge_33.3.png b/utils/test/reporting/reporting/functest/img/gauge_33.3.png Binary files differindex 364574b4a..364574b4a 100644 --- a/utils/test/reporting/functest/img/gauge_33.3.png +++ b/utils/test/reporting/reporting/functest/img/gauge_33.3.png diff --git a/utils/test/reporting/functest/img/gauge_41.7.png b/utils/test/reporting/reporting/functest/img/gauge_41.7.png Binary files differindex 8c3e910fa..8c3e910fa 100644 --- a/utils/test/reporting/functest/img/gauge_41.7.png +++ b/utils/test/reporting/reporting/functest/img/gauge_41.7.png diff --git a/utils/test/reporting/functest/img/gauge_50.png b/utils/test/reporting/reporting/functest/img/gauge_50.png Binary files differindex 2874b9fcf..2874b9fcf 100644 --- a/utils/test/reporting/functest/img/gauge_50.png +++ b/utils/test/reporting/reporting/functest/img/gauge_50.png diff --git a/utils/test/reporting/functest/img/gauge_58.3.png b/utils/test/reporting/reporting/functest/img/gauge_58.3.png Binary files differindex beedc8aa9..beedc8aa9 100644 --- a/utils/test/reporting/functest/img/gauge_58.3.png +++ b/utils/test/reporting/reporting/functest/img/gauge_58.3.png diff --git a/utils/test/reporting/functest/img/gauge_66.7.png b/utils/test/reporting/reporting/functest/img/gauge_66.7.png Binary files differindex 93f44d133..93f44d133 100644 --- a/utils/test/reporting/functest/img/gauge_66.7.png +++ b/utils/test/reporting/reporting/functest/img/gauge_66.7.png diff --git a/utils/test/reporting/functest/img/gauge_75.png b/utils/test/reporting/reporting/functest/img/gauge_75.png Binary files differindex 9fc261ff8..9fc261ff8 100644 --- a/utils/test/reporting/functest/img/gauge_75.png +++ b/utils/test/reporting/reporting/functest/img/gauge_75.png diff --git a/utils/test/reporting/functest/img/gauge_8.3.png b/utils/test/reporting/reporting/functest/img/gauge_8.3.png Binary files differindex 59f86571e..59f86571e 100644 --- a/utils/test/reporting/functest/img/gauge_8.3.png +++ b/utils/test/reporting/reporting/functest/img/gauge_8.3.png diff --git a/utils/test/reporting/functest/img/gauge_83.3.png b/utils/test/reporting/reporting/functest/img/gauge_83.3.png Binary files differindex 27ae4ec54..27ae4ec54 100644 --- a/utils/test/reporting/functest/img/gauge_83.3.png +++ b/utils/test/reporting/reporting/functest/img/gauge_83.3.png diff --git a/utils/test/reporting/functest/img/gauge_91.7.png b/utils/test/reporting/reporting/functest/img/gauge_91.7.png Binary files differindex 280865714..280865714 100644 --- a/utils/test/reporting/functest/img/gauge_91.7.png +++ b/utils/test/reporting/reporting/functest/img/gauge_91.7.png diff --git a/utils/test/reporting/functest/img/icon-nok.png b/utils/test/reporting/reporting/functest/img/icon-nok.png Binary files differindex 526b5294b..526b5294b 100644 --- a/utils/test/reporting/functest/img/icon-nok.png +++ b/utils/test/reporting/reporting/functest/img/icon-nok.png diff --git a/utils/test/reporting/functest/img/icon-ok.png b/utils/test/reporting/reporting/functest/img/icon-ok.png Binary files differindex 3a9de2e89..3a9de2e89 100644 --- a/utils/test/reporting/functest/img/icon-ok.png +++ b/utils/test/reporting/reporting/functest/img/icon-ok.png diff --git a/utils/test/reporting/functest/img/weather-clear.png b/utils/test/reporting/reporting/functest/img/weather-clear.png Binary files differindex a0d967750..a0d967750 100644 --- a/utils/test/reporting/functest/img/weather-clear.png +++ b/utils/test/reporting/reporting/functest/img/weather-clear.png diff --git a/utils/test/reporting/functest/img/weather-few-clouds.png b/utils/test/reporting/reporting/functest/img/weather-few-clouds.png Binary files differindex acfa78398..acfa78398 100644 --- a/utils/test/reporting/functest/img/weather-few-clouds.png +++ b/utils/test/reporting/reporting/functest/img/weather-few-clouds.png diff --git a/utils/test/reporting/functest/img/weather-overcast.png b/utils/test/reporting/reporting/functest/img/weather-overcast.png Binary files differindex 4296246d0..4296246d0 100644 --- a/utils/test/reporting/functest/img/weather-overcast.png +++ b/utils/test/reporting/reporting/functest/img/weather-overcast.png diff --git a/utils/test/reporting/functest/img/weather-storm.png b/utils/test/reporting/reporting/functest/img/weather-storm.png Binary files differindex 956f0e20f..956f0e20f 100644 --- a/utils/test/reporting/functest/img/weather-storm.png +++ b/utils/test/reporting/reporting/functest/img/weather-storm.png diff --git a/utils/test/reporting/functest/index.html b/utils/test/reporting/reporting/functest/index.html index bb1bce209..bb1bce209 100644 --- a/utils/test/reporting/functest/index.html +++ b/utils/test/reporting/reporting/functest/index.html diff --git a/utils/test/reporting/functest/reporting-status.py b/utils/test/reporting/reporting/functest/reporting-status.py index e700e047f..c7c2051a3 100755 --- a/utils/test/reporting/functest/reporting-status.py +++ b/utils/test/reporting/reporting/functest/reporting-status.py @@ -18,6 +18,8 @@ import scenarioResult as sr # manage conf import utils.reporting_utils as rp_utils +"""Functest reporting status""" + # Logger logger = rp_utils.getLogger("Functest-Status") @@ -107,7 +109,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)) @@ -125,7 +126,7 @@ for version in versions: # in case of more than 1 architecture supported # precise the architecture installer_display = installer - if (len(architectures) > 1): + if "fuel" in installer: installer_display = installer + "@" + architecture # For all the scenarios get results @@ -273,7 +274,8 @@ for version in versions: templateEnv = jinja2.Environment( loader=templateLoader, autoescape=True) - TEMPLATE_FILE = "./functest/template/index-status-tmpl.html" + TEMPLATE_FILE = ("./reporting/functest/template" + "/index-status-tmpl.html") template = templateEnv.get_template(TEMPLATE_FILE) outputText = template.render( diff --git a/utils/test/reporting/functest/reporting-tempest.py b/utils/test/reporting/reporting/functest/reporting-tempest.py index 6e6585a32..bc2885639 100755 --- a/utils/test/reporting/functest/reporting-tempest.py +++ b/utils/test/reporting/reporting/functest/reporting-tempest.py @@ -1,4 +1,15 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 Orange 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 +# SPDX-license-identifier: Apache-2.0 + from urllib2 import Request, urlopen, URLError +from datetime import datetime import json import jinja2 import os @@ -97,7 +108,13 @@ for version in rp_utils.get_config('general.versions'): crit_rate = True # Expect that the suite duration is inferior to 30m - if result['details']['duration'] < criteria_duration: + stop_date = datetime.strptime(result['stop_date'], + '%Y-%m-%d %H:%M:%S') + start_date = datetime.strptime(result['start_date'], + '%Y-%m-%d %H:%M:%S') + + delta = stop_date - start_date + if (delta.total_seconds() < criteria_duration): crit_time = True result['criteria'] = {'tests': crit_tests, @@ -125,7 +142,7 @@ for version in rp_utils.get_config('general.versions'): templateEnv = jinja2.Environment(loader=templateLoader, autoescape=True) - TEMPLATE_FILE = "./functest/template/index-tempest-tmpl.html" + TEMPLATE_FILE = "./reporting/functest/template/index-tempest-tmpl.html" template = templateEnv.get_template(TEMPLATE_FILE) outputText = template.render(scenario_results=scenario_results, diff --git a/utils/test/reporting/functest/reporting-vims.py b/utils/test/reporting/reporting/functest/reporting-vims.py index b236b8963..14fddbe25 100755 --- a/utils/test/reporting/functest/reporting-vims.py +++ b/utils/test/reporting/reporting/functest/reporting-vims.py @@ -104,7 +104,7 @@ for version in versions: % result['details']['sig_test']['duration']) logger.debug("Signaling testing results: %s" % format_result) - except: + except Exception: logger.error("Data badly formatted") logger.debug("----------------------------------------") @@ -112,7 +112,7 @@ for version in versions: templateEnv = jinja2.Environment(loader=templateLoader, autoescape=True) - TEMPLATE_FILE = "./functest/template/index-vims-tmpl.html" + TEMPLATE_FILE = "./reporting/functest/template/index-vims-tmpl.html" template = templateEnv.get_template(TEMPLATE_FILE) outputText = template.render(scenario_results=scenario_results, diff --git a/utils/test/reporting/functest/scenarioResult.py b/utils/test/reporting/reporting/functest/scenarioResult.py index 5a54eed96..5a54eed96 100644 --- a/utils/test/reporting/functest/scenarioResult.py +++ b/utils/test/reporting/reporting/functest/scenarioResult.py diff --git a/utils/test/reporting/functest/template/index-status-tmpl.html b/utils/test/reporting/reporting/functest/template/index-status-tmpl.html index cc4edaac5..50fc648aa 100644 --- a/utils/test/reporting/functest/template/index-status-tmpl.html +++ b/utils/test/reporting/reporting/functest/template/index-status-tmpl.html @@ -72,6 +72,7 @@ $(document).ready(function (){ <li class="active"><a href="../../index.html">Home</a></li> <li><a href="status-apex.html">Apex</a></li> <li><a href="status-compass.html">Compass</a></li> + <li><a href="status-daisy.html">Daisy</a></li> <li><a href="status-fuel@x86.html">fuel@x86</a></li> <li><a href="status-fuel@aarch64.html">fuel@aarch64</a></li> <li><a href="status-joid.html">Joid</a></li> @@ -89,7 +90,7 @@ $(document).ready(function (){ <div class="panel-heading"><h4><b>List of last scenarios ({{version}}) run over the last {{period}} days </b></h4></div> <table class="table"> <tr> - <th width="40%">Scenario</th> + <th width="40%">HA Scenario</th> <th width="20%">Status</th> <th width="20%">Trend</th> <th width="10%">Score</th> @@ -97,14 +98,39 @@ $(document).ready(function (){ </tr> {% for scenario,iteration in scenario_stats.iteritems() -%} <tr class="tr-ok"> + {% if '-ha' in scenario -%} <td><a href={{scenario_results[scenario].getUrlLastRun()}}>{{scenario}}</a></td> <td><div id="gaugeScenario{{loop.index}}"></div></td> <td><div id="trend_svg{{loop.index}}"></div></td> <td>{{scenario_results[scenario].getScore()}}</td> <td>{{iteration}}</td> + {%- endif %} + </tr> + {%- endfor %} + <br> + </table> + <br> + <table class="table"> + <tr> + <th width="40%">NOHA Scenario</th> + <th width="20%">Status</th> + <th width="20%">Trend</th> + <th width="10%">Score</th> + <th width="10%">Iteration</th> + </tr> + {% for scenario,iteration in scenario_stats.iteritems() -%} + <tr class="tr-ok"> + {% if '-noha' in scenario -%} + <td><a href={{scenario_results[scenario].getUrlLastRun()}}>{{scenario}}</a></td> + <td><div id="gaugeScenario{{loop.index}}"></div></td> + <td><div id="trend_svg{{loop.index}}"></div></td> + <td>{{scenario_results[scenario].getScore()}}</td> + <td>{{iteration}}</td> + {%- endif %} </tr> {%- endfor %} - </table> + </table> + </div> diff --git a/utils/test/reporting/functest/template/index-tempest-tmpl.html b/utils/test/reporting/reporting/functest/template/index-tempest-tmpl.html index 3a222276e..3a222276e 100644 --- a/utils/test/reporting/functest/template/index-tempest-tmpl.html +++ b/utils/test/reporting/reporting/functest/template/index-tempest-tmpl.html diff --git a/utils/test/reporting/functest/template/index-vims-tmpl.html b/utils/test/reporting/reporting/functest/template/index-vims-tmpl.html index cd51607b7..cd51607b7 100644 --- a/utils/test/reporting/functest/template/index-vims-tmpl.html +++ b/utils/test/reporting/reporting/functest/template/index-vims-tmpl.html diff --git a/utils/test/reporting/functest/testCase.py b/utils/test/reporting/reporting/functest/testCase.py index 9834f0753..9834f0753 100644 --- a/utils/test/reporting/functest/testCase.py +++ b/utils/test/reporting/reporting/functest/testCase.py diff --git a/utils/test/reporting/tests/__init__.py b/utils/test/reporting/reporting/qtip/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/reporting/tests/__init__.py +++ b/utils/test/reporting/reporting/qtip/__init__.py diff --git a/utils/test/reporting/qtip/index.html b/utils/test/reporting/reporting/qtip/index.html index 0f9df8564..0f9df8564 100644 --- a/utils/test/reporting/qtip/index.html +++ b/utils/test/reporting/reporting/qtip/index.html diff --git a/utils/test/reporting/qtip/reporting-status.py b/utils/test/reporting/reporting/qtip/reporting-status.py index 5967cf6b9..56f9e0aee 100644 --- a/utils/test/reporting/qtip/reporting-status.py +++ b/utils/test/reporting/reporting/qtip/reporting-status.py @@ -23,7 +23,7 @@ reportingDate = datetime.datetime.now().strftime("%Y-%m-%d %H:%M") logger.info("*******************************************") logger.info("* Generating reporting scenario status *") -logger.info("* Data retention = %s days *" % PERIOD) +logger.info("* Data retention = {} days *".format(PERIOD)) logger.info("* *") logger.info("*******************************************") @@ -33,7 +33,7 @@ def prepare_profile_file(version): if not os.path.exists(profile_dir): os.makedirs(profile_dir) - profile_file = '{}/scenario_history.txt'.format(profile_dir, version) + profile_file = "{}/scenario_history.txt".format(profile_dir) if not os.path.exists(profile_file): with open(profile_file, 'w') as f: info = 'date,scenario,installer,details,score\n' @@ -77,7 +77,7 @@ def render_html(prof_results, installer, version): template_env = jinja2.Environment(loader=template_loader, autoescape=True) - template_file = "./qtip/template/index-status-tmpl.html" + template_file = "./reporting/qtip/template/index-status-tmpl.html" template = template_env.get_template(template_file) render_outcome = template.render(prof_results=prof_results, @@ -106,5 +106,6 @@ def render_reporter(): rp_utils.generate_csv(profile_file) logger.info("CSV generated...") + if __name__ == '__main__': render_reporter() diff --git a/utils/test/reporting/qtip/template/index-status-tmpl.html b/utils/test/reporting/reporting/qtip/template/index-status-tmpl.html index 26da36ceb..92f3395dc 100644 --- a/utils/test/reporting/qtip/template/index-status-tmpl.html +++ b/utils/test/reporting/reporting/qtip/template/index-status-tmpl.html @@ -46,10 +46,11 @@ <nav> <ul class="nav nav-justified"> <li class="active"><a href="http://testresults.opnfv.org/reporting/index.html">Home</a></li> - <li><a href="index-status-apex.html">Apex</a></li> - <li><a href="index-status-compass.html">Compass</a></li> - <li><a href="index-status-fuel.html">Fuel</a></li> - <li><a href="index-status-joid.html">Joid</a></li> + <li><a href="status-apex.html">Apex</a></li> + <li><a href="status-compass.html">Compass</a></li> + <li><a href="status-daisy.html">Daisy</a></li> + <li><a href="status-fuel.html">Fuel</a></li> + <li><a href="status-joid.html">Joid</a></li> </ul> </nav> </div> diff --git a/utils/test/reporting/reporting.yaml b/utils/test/reporting/reporting/reporting.yaml index 1692f481d..26feb31d3 100644 --- a/utils/test/reporting/reporting.yaml +++ b/utils/test/reporting/reporting/reporting.yaml @@ -3,6 +3,7 @@ general: installers: - apex - compass + - daisy - fuel - joid diff --git a/utils/test/reporting/tests/unit/__init__.py b/utils/test/reporting/reporting/storperf/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/reporting/tests/unit/__init__.py +++ b/utils/test/reporting/reporting/storperf/__init__.py diff --git a/utils/test/reporting/storperf/reporting-status.py b/utils/test/reporting/reporting/storperf/reporting-status.py index 888e339f8..0c188a338 100644 --- a/utils/test/reporting/storperf/reporting-status.py +++ b/utils/test/reporting/reporting/storperf/reporting-status.py @@ -131,7 +131,7 @@ for version in versions: templateEnv = jinja2.Environment(loader=templateLoader, autoescape=True) - TEMPLATE_FILE = "./storperf/template/index-status-tmpl.html" + TEMPLATE_FILE = "./reporting/storperf/template/index-status-tmpl.html" template = templateEnv.get_template(TEMPLATE_FILE) outputText = template.render(scenario_results=scenario_result_criteria, diff --git a/utils/test/reporting/storperf/template/index-status-tmpl.html b/utils/test/reporting/reporting/storperf/template/index-status-tmpl.html index e872272c3..e872272c3 100644 --- a/utils/test/reporting/storperf/template/index-status-tmpl.html +++ b/utils/test/reporting/reporting/storperf/template/index-status-tmpl.html diff --git a/utils/test/reporting/tests/unit/utils/__init__.py b/utils/test/reporting/reporting/tests/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/reporting/tests/unit/utils/__init__.py +++ b/utils/test/reporting/reporting/tests/__init__.py diff --git a/utils/test/reporting/utils/__init__.py b/utils/test/reporting/reporting/tests/unit/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/reporting/utils/__init__.py +++ b/utils/test/reporting/reporting/tests/unit/__init__.py diff --git a/utils/test/reporting/pages/app/scripts/app.config.js b/utils/test/reporting/reporting/tests/unit/utils/__init__.py index e69de29bb..e69de29bb 100644 --- a/utils/test/reporting/pages/app/scripts/app.config.js +++ b/utils/test/reporting/reporting/tests/unit/utils/__init__.py diff --git a/utils/test/reporting/tests/unit/utils/test_utils.py b/utils/test/reporting/reporting/tests/unit/utils/test_utils.py index b9c39806c..9614d74ff 100644 --- a/utils/test/reporting/tests/unit/utils/test_utils.py +++ b/utils/test/reporting/reporting/tests/unit/utils/test_utils.py @@ -10,7 +10,7 @@ import logging import unittest -from utils import reporting_utils +from reporting.utils import reporting_utils class reportingUtilsTesting(unittest.TestCase): @@ -20,10 +20,9 @@ class reportingUtilsTesting(unittest.TestCase): def setUp(self): self.test = reporting_utils - def test_getConfig(self): - self.assertEqual(self.test.get_config("general.period"), 10) -# TODO -# ... + def test_foo(self): + self.assertTrue(0 < 1) + if __name__ == "__main__": unittest.main(verbosity=2) diff --git a/utils/test/reporting/reporting/utils/__init__.py b/utils/test/reporting/reporting/utils/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/utils/test/reporting/reporting/utils/__init__.py diff --git a/utils/test/reporting/utils/reporting_utils.py b/utils/test/reporting/reporting/utils/reporting_utils.py index 599a93818..62820914a 100644 --- a/utils/test/reporting/utils/reporting_utils.py +++ b/utils/test/reporting/reporting/utils/reporting_utils.py @@ -95,7 +95,7 @@ def getApiResults(case, installer, scenario, version): k = response.read() results = json.loads(k) except URLError as e: - print('No kittez. Got an error code:', e) + print 'No kittez. Got an error code:'.format(e) return results @@ -117,19 +117,31 @@ 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) + try: + 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 KeyError: + print ('No pagination detected') + except URLError as err: + print 'Got an error code: {}'.format(err) if test_results is not None: test_results.reverse() - scenario_results = {} for r in test_results: @@ -142,7 +154,7 @@ def getScenarios(case, installer, version): exclude_noha = get_config('functest.exclude_noha') if ((exclude_virtual_pod and "virtual" in r['pod_name']) or (exclude_noha and "noha" in r['scenario'])): - print("exclude virtual pod results...") + print "exclude virtual pod results..." else: scenario_results[r['scenario']].append(r) @@ -157,7 +169,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') @@ -174,7 +185,7 @@ def getScenarioStatus(installer, version): results = json.loads(k) test_results = results['results'] except URLError as e: - print('Got an error code:', e) + print 'Got an error code: {}'.format(e) scenario_results = {} result_dict = {} @@ -213,8 +224,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: {}'.format(err) result_dict = {} if results: @@ -236,7 +247,7 @@ def getNbtestOk(results): if "PASS" in v: nb_test_ok += 1 except: - print("Cannot retrieve test status") + print "Cannot retrieve test status" return nb_test_ok @@ -311,7 +322,7 @@ def getJenkinsUrl(build_tag): "/" + str(build_id[0])) jenkins_url = url_base + url_id + "/console" except: - print('Impossible to get jenkins url:') + print 'Impossible to get jenkins url:' if "jenkins-" not in build_tag: jenkins_url = None @@ -324,7 +335,7 @@ def getScenarioPercent(scenario_score, scenario_criteria): try: score = float(scenario_score) / float(scenario_criteria) * 100 except: - print('Impossible to calculate the percentage score') + print 'Impossible to calculate the percentage score' return score @@ -410,7 +421,7 @@ def get_percent(four_list, ten_list): def _test(): status = getScenarioStatus("compass", "master") - print("status:++++++++++++++++++++++++") + print "status:++++++++++++++++++++++++" print(json.dumps(status, indent=4)) @@ -427,9 +438,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 @@ -447,6 +458,6 @@ def export_pdf(pdf_path, pdf_doc_name): try: pdfkit.from_file(pdf_path, pdf_doc_name) except IOError: - print("Error but pdf generated anyway...") + print "Error but pdf generated anyway..." except: - print("impossible to generate PDF") + print "impossible to generate PDF" diff --git a/utils/test/reporting/utils/scenarioResult.py b/utils/test/reporting/reporting/utils/scenarioResult.py index 6029d7f42..6029d7f42 100644 --- a/utils/test/reporting/utils/scenarioResult.py +++ b/utils/test/reporting/reporting/utils/scenarioResult.py diff --git a/utils/test/reporting/reporting/yardstick/__init__.py b/utils/test/reporting/reporting/yardstick/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/utils/test/reporting/reporting/yardstick/__init__.py diff --git a/utils/test/reporting/yardstick/img/gauge_0.png b/utils/test/reporting/reporting/yardstick/img/gauge_0.png Binary files differindex ecefc0e66..ecefc0e66 100644 --- a/utils/test/reporting/yardstick/img/gauge_0.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_0.png diff --git a/utils/test/reporting/yardstick/img/gauge_100.png b/utils/test/reporting/reporting/yardstick/img/gauge_100.png Binary files differindex e199e1561..e199e1561 100644 --- a/utils/test/reporting/yardstick/img/gauge_100.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_100.png diff --git a/utils/test/reporting/yardstick/img/gauge_16.7.png b/utils/test/reporting/reporting/yardstick/img/gauge_16.7.png Binary files differindex 3e3993c3b..3e3993c3b 100644 --- a/utils/test/reporting/yardstick/img/gauge_16.7.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_16.7.png diff --git a/utils/test/reporting/yardstick/img/gauge_25.png b/utils/test/reporting/reporting/yardstick/img/gauge_25.png Binary files differindex 4923659b9..4923659b9 100644 --- a/utils/test/reporting/yardstick/img/gauge_25.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_25.png diff --git a/utils/test/reporting/yardstick/img/gauge_33.3.png b/utils/test/reporting/reporting/yardstick/img/gauge_33.3.png Binary files differindex 364574b4a..364574b4a 100644 --- a/utils/test/reporting/yardstick/img/gauge_33.3.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_33.3.png diff --git a/utils/test/reporting/yardstick/img/gauge_41.7.png b/utils/test/reporting/reporting/yardstick/img/gauge_41.7.png Binary files differindex 8c3e910fa..8c3e910fa 100644 --- a/utils/test/reporting/yardstick/img/gauge_41.7.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_41.7.png diff --git a/utils/test/reporting/yardstick/img/gauge_50.png b/utils/test/reporting/reporting/yardstick/img/gauge_50.png Binary files differindex 2874b9fcf..2874b9fcf 100644 --- a/utils/test/reporting/yardstick/img/gauge_50.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_50.png diff --git a/utils/test/reporting/yardstick/img/gauge_58.3.png b/utils/test/reporting/reporting/yardstick/img/gauge_58.3.png Binary files differindex beedc8aa9..beedc8aa9 100644 --- a/utils/test/reporting/yardstick/img/gauge_58.3.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_58.3.png diff --git a/utils/test/reporting/yardstick/img/gauge_66.7.png b/utils/test/reporting/reporting/yardstick/img/gauge_66.7.png Binary files differindex 93f44d133..93f44d133 100644 --- a/utils/test/reporting/yardstick/img/gauge_66.7.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_66.7.png diff --git a/utils/test/reporting/yardstick/img/gauge_75.png b/utils/test/reporting/reporting/yardstick/img/gauge_75.png Binary files differindex 9fc261ff8..9fc261ff8 100644 --- a/utils/test/reporting/yardstick/img/gauge_75.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_75.png diff --git a/utils/test/reporting/yardstick/img/gauge_8.3.png b/utils/test/reporting/reporting/yardstick/img/gauge_8.3.png Binary files differindex 59f86571e..59f86571e 100644 --- a/utils/test/reporting/yardstick/img/gauge_8.3.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_8.3.png diff --git a/utils/test/reporting/yardstick/img/gauge_83.3.png b/utils/test/reporting/reporting/yardstick/img/gauge_83.3.png Binary files differindex 27ae4ec54..27ae4ec54 100644 --- a/utils/test/reporting/yardstick/img/gauge_83.3.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_83.3.png diff --git a/utils/test/reporting/yardstick/img/gauge_91.7.png b/utils/test/reporting/reporting/yardstick/img/gauge_91.7.png Binary files differindex 280865714..280865714 100644 --- a/utils/test/reporting/yardstick/img/gauge_91.7.png +++ b/utils/test/reporting/reporting/yardstick/img/gauge_91.7.png diff --git a/utils/test/reporting/yardstick/img/icon-nok.png b/utils/test/reporting/reporting/yardstick/img/icon-nok.png Binary files differindex 526b5294b..526b5294b 100644 --- a/utils/test/reporting/yardstick/img/icon-nok.png +++ b/utils/test/reporting/reporting/yardstick/img/icon-nok.png diff --git a/utils/test/reporting/yardstick/img/icon-ok.png b/utils/test/reporting/reporting/yardstick/img/icon-ok.png Binary files differindex 3a9de2e89..3a9de2e89 100644 --- a/utils/test/reporting/yardstick/img/icon-ok.png +++ b/utils/test/reporting/reporting/yardstick/img/icon-ok.png diff --git a/utils/test/reporting/yardstick/img/weather-clear.png b/utils/test/reporting/reporting/yardstick/img/weather-clear.png Binary files differindex a0d967750..a0d967750 100644 --- a/utils/test/reporting/yardstick/img/weather-clear.png +++ b/utils/test/reporting/reporting/yardstick/img/weather-clear.png diff --git a/utils/test/reporting/yardstick/img/weather-few-clouds.png b/utils/test/reporting/reporting/yardstick/img/weather-few-clouds.png Binary files differindex acfa78398..acfa78398 100644 --- a/utils/test/reporting/yardstick/img/weather-few-clouds.png +++ b/utils/test/reporting/reporting/yardstick/img/weather-few-clouds.png diff --git a/utils/test/reporting/yardstick/img/weather-overcast.png b/utils/test/reporting/reporting/yardstick/img/weather-overcast.png Binary files differindex 4296246d0..4296246d0 100644 --- a/utils/test/reporting/yardstick/img/weather-overcast.png +++ b/utils/test/reporting/reporting/yardstick/img/weather-overcast.png diff --git a/utils/test/reporting/yardstick/img/weather-storm.png b/utils/test/reporting/reporting/yardstick/img/weather-storm.png Binary files differindex 956f0e20f..956f0e20f 100644 --- a/utils/test/reporting/yardstick/img/weather-storm.png +++ b/utils/test/reporting/reporting/yardstick/img/weather-storm.png diff --git a/utils/test/reporting/yardstick/index.html b/utils/test/reporting/reporting/yardstick/index.html index 488f1421d..488f1421d 100644 --- a/utils/test/reporting/yardstick/index.html +++ b/utils/test/reporting/reporting/yardstick/index.html diff --git a/utils/test/reporting/yardstick/reporting-status.py b/utils/test/reporting/reporting/yardstick/reporting-status.py index 12f42ca31..85c386bf1 100644 --- a/utils/test/reporting/yardstick/reporting-status.py +++ b/utils/test/reporting/reporting/yardstick/reporting-status.py @@ -106,7 +106,7 @@ for version in versions: templateEnv = jinja2.Environment(loader=templateLoader, autoescape=True) - TEMPLATE_FILE = "./yardstick/template/index-status-tmpl.html" + TEMPLATE_FILE = "./reporting/yardstick/template/index-status-tmpl.html" template = templateEnv.get_template(TEMPLATE_FILE) outputText = template.render(scenario_results=scenario_result_criteria, diff --git a/utils/test/reporting/yardstick/scenarios.py b/utils/test/reporting/reporting/yardstick/scenarios.py index 26e8c8bb0..26e8c8bb0 100644 --- a/utils/test/reporting/yardstick/scenarios.py +++ b/utils/test/reporting/reporting/yardstick/scenarios.py diff --git a/utils/test/reporting/yardstick/template/index-status-tmpl.html b/utils/test/reporting/reporting/yardstick/template/index-status-tmpl.html index 77ba9502f..77ba9502f 100644 --- a/utils/test/reporting/yardstick/template/index-status-tmpl.html +++ b/utils/test/reporting/reporting/yardstick/template/index-status-tmpl.html diff --git a/utils/test/reporting/requirements.txt b/utils/test/reporting/requirements.txt new file mode 100644 index 000000000..344064ddc --- /dev/null +++ b/utils/test/reporting/requirements.txt @@ -0,0 +1,7 @@ +pdfkit>=0.6.1 # MIT +wkhtmltopdf-pack>=0.12.3 # MIT +PyYAML>=3.10.0 # MIT +simplejson>=2.2.0 # MIT +Jinja2!=2.9.0,!=2.9.1,!=2.9.2,!=2.9.3,!=2.9.4,>=2.8 # BSD License (3 clause) +requests!=2.12.2,>=2.10.0 # Apache-2.0 +tornado>=4.4.2 # Apache-2.0 diff --git a/utils/test/reporting/run_test.sh b/utils/test/reporting/run_test.sh new file mode 100755 index 000000000..b83b550b8 --- /dev/null +++ b/utils/test/reporting/run_test.sh @@ -0,0 +1,3 @@ +#!/bin/bash +tox +exit $? diff --git a/utils/test/reporting/run_unit_tests.sh b/utils/test/reporting/run_unit_tests.sh deleted file mode 100755 index 6b0e3b2b1..000000000 --- a/utils/test/reporting/run_unit_tests.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -set -o errexit -set -o pipefail - -# ****************************** -# prepare the env for the tests -# ****************************** -# Either Workspace is set (CI) -if [ -z $WORKSPACE ] -then - WORKSPACE="." -fi - -export CONFIG_REPORTING_YAML=./reporting.yaml - -# *************** -# Run unit tests -# *************** -echo "Running unit tests..." - -# start vitual env -virtualenv $WORKSPACE/reporting_venv -source $WORKSPACE/reporting_venv/bin/activate - -# install python packages -easy_install -U setuptools -easy_install -U pip -pip install -r $WORKSPACE/docker/requirements.pip -pip install -e $WORKSPACE - -python $WORKSPACE/setup.py develop - -# unit tests -# TODO: remove cover-erase -# To be deleted when all functest packages will be listed -nosetests --with-xunit \ - --cover-package=utils \ - --with-coverage \ - --cover-xml \ - tests/unit -rc=$? - -deactivate diff --git a/utils/test/reporting/setup.cfg b/utils/test/reporting/setup.cfg new file mode 100644 index 000000000..9543945c7 --- /dev/null +++ b/utils/test/reporting/setup.cfg @@ -0,0 +1,12 @@ +[metadata] +name = reporting +version = 1 +home-page = https://wiki.opnfv.org/display/testing + +[files] +packages = + reporting + api +scripts = + docker/reporting.sh + docker/web_server.sh diff --git a/utils/test/reporting/setup.py b/utils/test/reporting/setup.py index 627785eca..17849f67b 100644 --- a/utils/test/reporting/setup.py +++ b/utils/test/reporting/setup.py @@ -1,22 +1,23 @@ -############################################################################## +#!/usr/bin/env python + +# Copyright (c) 2017 Orange 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 -############################################################################## -from setuptools import setup, find_packages +# pylint: disable=missing-docstring +import setuptools +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass -setup( - name="reporting", - version="master", - packages=find_packages(), - include_package_data=True, - package_data={ - }, - url="https://www.opnfv.org", - install_requires=["coverage==4.1", - "mock==1.3.0", - "nose==1.3.7"], -) +setuptools.setup( + setup_requires=['pbr>=1.8'], + pbr=True) diff --git a/utils/test/reporting/test-requirements.txt b/utils/test/reporting/test-requirements.txt new file mode 100644 index 000000000..738f50862 --- /dev/null +++ b/utils/test/reporting/test-requirements.txt @@ -0,0 +1,5 @@ +coverage>=4.0 # Apache-2.0 +mock>=2.0 # BSD +nose # LGPL +flake8<2.6.0,>=2.5.4 # MIT +pylint==1.4.5 # GPLv2 diff --git a/utils/test/reporting/tox.ini b/utils/test/reporting/tox.ini new file mode 100644 index 000000000..2df503050 --- /dev/null +++ b/utils/test/reporting/tox.ini @@ -0,0 +1,27 @@ +[tox] +envlist = pep8,pylint,py27 + +[testenv] +usedevelop = True +deps = + -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = nosetests --with-xunit \ + --with-coverage \ + --cover-tests \ + --cover-package=reporting \ + --cover-xml \ + --cover-html \ + reporting/tests/unit + +[testenv:pep8] +basepython = python2.7 +commands = flake8 + +[testenv:pylint] +basepython = python2.7 +whitelist_externals = bash +commands = + bash -c "\ + pylint --disable=locally-disabled reporting| \ + tee pylint.out | sed -ne '/Raw metrics/,//p'" |