diff options
author | 2018-04-13 15:59:33 -0700 | |
---|---|---|
committer | 2018-04-13 15:59:33 -0700 | |
commit | 2c374d687fbfcaadf99509ed632f168d602859cb (patch) | |
tree | 7d9f7a20da28fe92a5eaeaa072a673512e92f4f5 | |
parent | 6b60ac504256b6388e88647df65f6648eeb80e92 (diff) |
[VVP] adding config for test coverage report
modifed tox, pom, and tests to create coverage report
Change-Id: I98321c3d5c205622a3b4f5662566934f323ba70f
Issue-ID: VVP-56
Signed-off-by: stark, steven <ss820f@att.com>
-rw-r--r-- | django/engagementmanager/tests/test_expanded_eng.py | 2 | ||||
-rw-r--r-- | django/vvp/settings/tox_settings.py | 1 | ||||
-rwxr-xr-x | mvn-phase-script.sh | 60 | ||||
-rw-r--r-- | pom.xml | 39 | ||||
-rw-r--r-- | tox.ini | 4 |
5 files changed, 104 insertions, 2 deletions
diff --git a/django/engagementmanager/tests/test_expanded_eng.py b/django/engagementmanager/tests/test_expanded_eng.py index de2a622..82b1616 100644 --- a/django/engagementmanager/tests/test_expanded_eng.py +++ b/django/engagementmanager/tests/test_expanded_eng.py @@ -323,7 +323,7 @@ class testGetExpandedEngsAndSearch(TestBaseEntity): urlStr = self.urlPrefix + 'vf' + str(vf.uuid) + '/vfcs/' vfc_of_x_response = self.c.get( urlStr, **{'HTTP_AUTHORIZATION': "token " + self.token}) - vfc_list = json.loads(vfc_of_x_response.content) + vfc_list = json.loads(vfc_of_x_response.content) or {} for vfc in vfc_list: if (vfc['name'] == self.random_keyword): bool_flag = True diff --git a/django/vvp/settings/tox_settings.py b/django/vvp/settings/tox_settings.py index ff1aabd..e562bc3 100644 --- a/django/vvp/settings/tox_settings.py +++ b/django/vvp/settings/tox_settings.py @@ -99,6 +99,7 @@ INSTALLED_APPS = [ 'rest_framework', 'engagementmanager.apps.EngagementmanagerConfig', 'validationmanager.apps.ValidationmanagerConfig', + 'django_jenkins', ] MIDDLEWARE_CLASSES = [ diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh new file mode 100755 index 0000000..77979dc --- /dev/null +++ b/mvn-phase-script.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# ================================================================================ +# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. + +set -ex + + +echo "running script: [$0] for module [$1] at stage [$2]" + +MVN_PROJECT_MODULEID="$1" +MVN_PHASE="$2" +PROJECT_ROOT=$(dirname $0) + +run_tox_test () { + CURDIR=$(pwd) + TOXINIS=. + for TOXINI in "${TOXINIS[@]}"; do + DIR=$(echo "$TOXINI" | rev | cut -f2- -d'/' | rev) + cd "${CURDIR}/${DIR}" + rm -rf ./venv-tox ./.tox + virtualenv ./venv-tox + source ./venv-tox/bin/activate + pip install --upgrade pip + pip install --upgrade tox argparse + pip freeze + tox + deactivate + rm -rf ./venv-tox ./.tox + done +} + +# Customize the section below for each project +case $MVN_PHASE in +test) + echo "==> test phase script" + run_tox_test + ;; +*) + echo "==> unprocessed phase" + ;; +esac + + + @@ -25,9 +25,28 @@ <docker.latest.tag>${project.version}-latest</docker.latest.tag> <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry> <docker.push.registry>nexus3.onap.org:10003</docker.push.registry> + <!--sonar--> + <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding> + <sonar.sources>.</sonar.sources> + <sonar.python.coverage.reportPath>django/reports/coverage.xml</sonar.python.coverage.reportPath> + <sonar.language>py</sonar.language> + <sonar.pluginName>python</sonar.pluginName> + <sonar.inclusions>django/**.py</sonar.inclusions> </properties> <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <configuration> + <executable>${session.executionRootDirectory}/mvn-phase-script.sh</executable> + </configuration> + </plugin> + </plugins> + </pluginManagement> <plugins> <plugin> <groupId>org.sonatype.plugins</groupId> @@ -97,6 +116,26 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.2.1</version> + <executions> + <execution> + <id>test script</id> + <phase>test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>__</argument> + <argument>test</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> <distributionManagement> @@ -38,8 +38,10 @@ setenv = [testenv:py36-django1-10-6] basepython = python3.6 deps = -r{toxinidir}/django/requirements.txt + django-jenkins + coverage commands = python --version - django-admin.py test + python {toxinidir}/django/manage.py jenkins --enable-coverage [testenv:style] basepython = python3 |