summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gauld <ag1282@att.com>2018-02-21 11:14:46 -0500
committerAndrew Gauld <ag1282@att.com>2018-02-21 11:20:16 -0500
commit373f0f3559049ea91a3fb47a445c554512c36435 (patch)
tree5ef98975d4a43abf0c17dc021b303010173de366
parente8e4e3878deb5e93ae25f93fe047708a170893ca (diff)
Make SONAR code coverage analysis work
Change-Id: I8091aea6127b78de404c986be74ecf44935ab92f Issue-ID: DCAEGEN2-355 Signed-off-by: Andrew Gauld <ag1282@att.com>
-rw-r--r--dcaeapplib/pom.xml2
-rw-r--r--dcaeapplib/tox.ini6
-rwxr-xr-xmvn-phase-script.sh14
-rw-r--r--onap-dcae-cbs-docker-client/.coveragerc5
-rw-r--r--onap-dcae-cbs-docker-client/pom.xml2
-rw-r--r--onap-dcae-cbs-docker-client/tox.ini5
-rw-r--r--onap-dcae-dcaepolicy-lib/.coveragerc4
-rw-r--r--onap-dcae-dcaepolicy-lib/pom.xml1
-rw-r--r--onap-dcae-dcaepolicy-lib/tox.ini5
-rw-r--r--pom.xml18
-rw-r--r--python-discovery-client/pom.xml2
-rw-r--r--python-discovery-client/tox.ini6
-rw-r--r--python-dockering/pom.xml2
-rw-r--r--python-dockering/tox.ini6
-rw-r--r--scripts/mvn-phase-lib.sh7
-rw-r--r--scripts/pom.xml2
16 files changed, 39 insertions, 48 deletions
diff --git a/dcaeapplib/pom.xml b/dcaeapplib/pom.xml
index 878e7c6..66e73da 100644
--- a/dcaeapplib/pom.xml
+++ b/dcaeapplib/pom.xml
@@ -40,7 +40,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<sonar.language>py</sonar.language>
<sonar.pluginName>Python</sonar.pluginName>
<sonar.inclusions>**/*.py</sonar.inclusions>
- <sonar.exclusions>tests/*</sonar.exclusions>
+ <sonar.exclusions>tests/*,setup.py</sonar.exclusions>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
diff --git a/dcaeapplib/tox.ini b/dcaeapplib/tox.ini
index 9eb453c..653ac3f 100644
--- a/dcaeapplib/tox.ini
+++ b/dcaeapplib/tox.ini
@@ -2,10 +2,12 @@
envlist = py27,py35
[testenv]
deps=
- onap-dcae-cbs-docker-client>=0.0.2
+ onap-dcae-cbs-docker-client>=0.0.5
pytest
coverage
pytest-cov
setenv =
PYTHONPATH={toxinidir}
-commands=pytest --junitxml xunit-results.xml --cov dcaeapplib --cov-report xml
+commands=
+ pytest --junitxml xunit-results.xml --cov dcaeapplib --cov-report xml
+ coverage xml
diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh
index 5fa716a..29290ca 100755
--- a/mvn-phase-script.sh
+++ b/mvn-phase-script.sh
@@ -33,10 +33,7 @@ if [ -z "${MVN_NEXUSPROXY}" ]; then
echo "MVN_NEXUSPROXY environment variable not set. Cannot proceed"
exit 1
fi
-if [ -z "$SETTINGS_FILE" ]; then
- echo "SETTINGS_FILE environment variable not set. Cannot proceed"
- exit 2
-fi
+export SETTINGS_FILE=${SETTINGS_FILE:-$HOME/.m2/settings.xml}
set +e
if ! wget -O ${PROJECT_ROOT}/mvn-phase-lib.sh \
@@ -86,9 +83,12 @@ test)
echo "==> test phase script"
case $MVN_PROJECT_MODULEID in
*)
- set +e
- run_tox_test
- set -e
+ if [ -f tox.ini ]
+ then
+ set -e
+ run_tox_test
+ set +e
+ fi
;;
esac
;;
diff --git a/onap-dcae-cbs-docker-client/.coveragerc b/onap-dcae-cbs-docker-client/.coveragerc
index 38c506c..c60c1ee 100644
--- a/onap-dcae-cbs-docker-client/.coveragerc
+++ b/onap-dcae-cbs-docker-client/.coveragerc
@@ -21,8 +21,3 @@ exclude_lines =
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
-
-[xml]
-output = coverage-reports/coverage-configbinding.xml
-
-
diff --git a/onap-dcae-cbs-docker-client/pom.xml b/onap-dcae-cbs-docker-client/pom.xml
index d334aae..bbbdc12 100644
--- a/onap-dcae-cbs-docker-client/pom.xml
+++ b/onap-dcae-cbs-docker-client/pom.xml
@@ -45,7 +45,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<sonar.language>py</sonar.language>
<sonar.pluginName>Python</sonar.pluginName>
<sonar.inclusions>**/*.py</sonar.inclusions>
- <sonar.exclusions>tests/*</sonar.exclusions>
+ <sonar.exclusions>tests/*,setup.py</sonar.exclusions>
<sonar.host.url>http://135.205.228.63:9000</sonar.host.url>
</properties>
<build>
diff --git a/onap-dcae-cbs-docker-client/tox.ini b/onap-dcae-cbs-docker-client/tox.ini
index cad80d0..d3aa5da 100644
--- a/onap-dcae-cbs-docker-client/tox.ini
+++ b/onap-dcae-cbs-docker-client/tox.ini
@@ -10,5 +10,8 @@ deps=
setenv =
CONSUL_HOST = consuldotcom
HOSTNAME = mybestfrienddotcom
+ PYTHONPATH={toxinidir}
-commands=pytest --junitxml xunit-results.xml --cov {envsitepackagesdir}/onap_dcae_cbs_docker_client --cov-report=xml
+commands=
+ pytest --junitxml xunit-results.xml --cov onap_dcae_cbs_docker_client --cov-report xml
+ coverage xml
diff --git a/onap-dcae-dcaepolicy-lib/.coveragerc b/onap-dcae-dcaepolicy-lib/.coveragerc
index 26ed8ac..43c7005 100644
--- a/onap-dcae-dcaepolicy-lib/.coveragerc
+++ b/onap-dcae-dcaepolicy-lib/.coveragerc
@@ -23,7 +23,3 @@ exclude_lines =
if __name__ == .__main__.:
ignore_errors = True
-
-[xml]
-output = coverage-reports/coverage-onap_dcae_dcaepolicy_lib.xml
-
diff --git a/onap-dcae-dcaepolicy-lib/pom.xml b/onap-dcae-dcaepolicy-lib/pom.xml
index f8515d7..b3c230e 100644
--- a/onap-dcae-dcaepolicy-lib/pom.xml
+++ b/onap-dcae-dcaepolicy-lib/pom.xml
@@ -41,6 +41,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<sonar.language>py</sonar.language>
<sonar.pluginName>Python</sonar.pluginName>
<sonar.inclusions>**/*.py</sonar.inclusions>
+ <sonar.exclusions>tests/*,setup.py</sonar.exclusions>
<!-- for JavaScaript -->
<!--
<sonar.language>js</sonar.language>
diff --git a/onap-dcae-dcaepolicy-lib/tox.ini b/onap-dcae-dcaepolicy-lib/tox.ini
index 78af290..4b0573e 100644
--- a/onap-dcae-dcaepolicy-lib/tox.ini
+++ b/onap-dcae-dcaepolicy-lib/tox.ini
@@ -11,4 +11,7 @@ deps=
pytest-cov
setenv =
PYTHONPATH={toxinidir}
-commands=pytest --junitxml xunit-reports/xunit-result-onap_dcae_dcaepolicy_lib.xml --cov onap_dcae_dcaepolicy_lib --cov-report=xml
+commands=
+ -mkdir {toxinidir}/logs
+ pytest --junitxml xunit-reports/xunit-result-onap_dcae_dcaepolicy_lib.xml --cov onap_dcae_dcaepolicy_lib --cov-report xml
+ coverage xml
diff --git a/pom.xml b/pom.xml
index 6af5fc4..ac3c6c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -43,24 +43,10 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <sonar.skip>true</sonar.skip>
- <sonar.sources>*/</sonar.sources>
- <sonar.junit.reportsPath>**/xunit-results.xml</sonar.junit.reportsPath>
- <sonar.python.coverage.reportPath>**/coverage.xml</sonar.python.coverage.reportPath>
<!-- customize the SONARQUBE URL -->
<sonar.host.url>http://localhost:9000</sonar.host.url>
- <sonar.exclusions>tests/*</sonar.exclusions>
- <!-- below are language dependent -->
- <!-- for Python -->
- <sonar.language>py</sonar.language>
- <sonar.pluginName>Python</sonar.pluginName>
- <sonar.inclusions>**/*.py</sonar.inclusions>
- <!-- for JavaScaript -->
- <!--
- <sonar.language>js</sonar.language>
- <sonar.pluginName>JS</sonar.pluginName>
- <sonar.inclusions>**/*.js</sonar.inclusions>
- -->
+ <!-- taken care of in the children -->
+ <sonar.exclusions>**/*.py</sonar.exclusions>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
diff --git a/python-discovery-client/pom.xml b/python-discovery-client/pom.xml
index b420626..0854b5a 100644
--- a/python-discovery-client/pom.xml
+++ b/python-discovery-client/pom.xml
@@ -40,7 +40,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<sonar.language>py</sonar.language>
<sonar.pluginName>Python</sonar.pluginName>
<sonar.inclusions>**/*.py</sonar.inclusions>
- <sonar.exclusions>tests/*</sonar.exclusions>
+ <sonar.exclusions>tests/*,setup.py</sonar.exclusions>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
diff --git a/python-discovery-client/tox.ini b/python-discovery-client/tox.ini
index 5b492c9..d8386d8 100644
--- a/python-discovery-client/tox.ini
+++ b/python-discovery-client/tox.ini
@@ -7,4 +7,8 @@ deps=
pytest
coverage
pytest-cov
-commands=pytest --junitxml xunit-results.xml --cov {envsitepackagesdir}/discovery_client --cov-report=xml
+setenv=
+ PYTHONPATH={toxinidir}
+commands=
+ pytest --junitxml xunit-results.xml --cov discovery_client --cov-report=xml
+ coverage xml
diff --git a/python-dockering/pom.xml b/python-dockering/pom.xml
index aa24d9c..7dd0de5 100644
--- a/python-dockering/pom.xml
+++ b/python-dockering/pom.xml
@@ -40,7 +40,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<sonar.language>py</sonar.language>
<sonar.pluginName>Python</sonar.pluginName>
<sonar.inclusions>**/*.py</sonar.inclusions>
- <sonar.exclusions>tests/*</sonar.exclusions>
+ <sonar.exclusions>tests/*,setup.py</sonar.exclusions>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
diff --git a/python-dockering/tox.ini b/python-dockering/tox.ini
index 280cf78..71de279 100644
--- a/python-dockering/tox.ini
+++ b/python-dockering/tox.ini
@@ -7,4 +7,8 @@ deps=
pytest
coverage
pytest-cov
-commands=pytest --junitxml xunit-results.xml --cov {envsitepackagesdir}/dockering --cov-report=xml
+setenv=
+ PYTHONPATH={toxinidir}
+commands=
+ pytest --junitxml xunit-results.xml --cov dockering --cov-report xml
+ coverage xml
diff --git a/scripts/mvn-phase-lib.sh b/scripts/mvn-phase-lib.sh
index 6cef83e..ac755e0 100644
--- a/scripts/mvn-phase-lib.sh
+++ b/scripts/mvn-phase-lib.sh
@@ -52,10 +52,7 @@ if [ -z "$WORKSPACE" ]; then
WORKSPACE=$(pwd)
fi
-if [ -z "$SETTINGS_FILE" ]; then
- echo "SETTINGS_FILE environment variable not set. Cannot proceed"
- exit
-fi
+export SETTINGS_FILE=${SETTINGS_FILE:-$HOME/.m2/settings.xml}
@@ -214,7 +211,7 @@ test_templates()
run_tox_test()
{
- set -x
+ set -e -x
CURDIR=$(pwd)
TOXINIS=$(find . -name "tox.ini")
for TOXINI in "${TOXINIS[@]}"; do
diff --git a/scripts/pom.xml b/scripts/pom.xml
index 12e71fb..4ff29df 100644
--- a/scripts/pom.xml
+++ b/scripts/pom.xml
@@ -45,7 +45,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<sonar.language>py</sonar.language>
<sonar.pluginName>Python</sonar.pluginName>
<sonar.inclusions>**/*.py</sonar.inclusions>
- <sonar.exclusions>tests/*</sonar.exclusions>
+ <sonar.exclusions>tests/*,setup.py</sonar.exclusions>
<sonar.host.url>http://135.205.228.63:9000</sonar.host.url>
</properties>
<build>