summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gauld <ag1282@att.com>2018-02-22 11:35:58 -0500
committerAndrew Gauld <ag1282@att.com>2018-02-22 11:36:31 -0500
commitb758d3686595c03eeb1bfe4f50b86f28b7b8c86f (patch)
treed39f5509e654f1756bd80853275b34b2cd2a6872
parentbc19a3632f8df30e28876418f00cd96caa6dfa91 (diff)
Make SONAR code coverage work
Change-Id: I8a61f287d439a5bf0b2cb203e31b514a2cae0a5e Issue-ID: DCAEGEN2-355 Signed-off-by: Andrew Gauld <ag1282@att.com>
-rw-r--r--cdap/cdapplugin/.coveragerc4
-rw-r--r--cdap/cdapplugin/tox.ini6
-rw-r--r--cdap/pom.xml11
-rw-r--r--dcae-policy/.coveragerc4
-rw-r--r--dcae-policy/pom.xml14
-rw-r--r--dcae-policy/tox.ini6
-rw-r--r--docker/pom.xml14
-rw-r--r--docker/tox.ini6
-rwxr-xr-xmvn-phase-lib.sh11
-rwxr-xr-xmvn-phase-script.sh6
-rw-r--r--pom.xml4
-rw-r--r--relationships/pom.xml14
-rw-r--r--relationships/tox.ini6
13 files changed, 43 insertions, 63 deletions
diff --git a/cdap/cdapplugin/.coveragerc b/cdap/cdapplugin/.coveragerc
index 9d9d9a2..7e87c60 100644
--- a/cdap/cdapplugin/.coveragerc
+++ b/cdap/cdapplugin/.coveragerc
@@ -23,7 +23,3 @@ exclude_lines =
if __name__ == .__main__.:
ignore_errors = True
-
-[xml]
-output = coverage-reports/coverage-cdapcloudify.xml
-
diff --git a/cdap/cdapplugin/tox.ini b/cdap/cdapplugin/tox.ini
index 246851e..2f4bb03 100644
--- a/cdap/cdapplugin/tox.ini
+++ b/cdap/cdapplugin/tox.ini
@@ -7,4 +7,8 @@ deps=
pytest
coverage
pytest-cov
-commands=pytest --junitxml xunit-reports/xunit-result-cdapcloudify.xml --cov {envsitepackagesdir} --cov-report=xml
+setenv=
+ PYTHONPATH={toxinidir}
+commands=
+ pytest --junitxml xunit-results.xml --cov cdapcloudify --cov-report xml
+ coverage xml
diff --git a/cdap/pom.xml b/cdap/pom.xml
index 3fcbb4e..e0907c5 100644
--- a/cdap/pom.xml
+++ b/cdap/pom.xml
@@ -33,14 +33,13 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <!-- sonar -->
- <sonar.skip>true</sonar.skip>
<sonar.sources>cdapplugin/</sonar.sources>
- <sonar.junit.reportspath>cdapplugin/xunit-reports/xunit-result-cdapcloudify.xml</sonar.junit.reportspath>
- <sonar.python.coverage.reportpath>cdapplugin/coverage-reports/coverage-cdapcloudify.xml</sonar.python.coverage.reportpath>
+ <sonar.junit.reportspath>cdapplugin/xunit-results.xml</sonar.junit.reportspath>
+ <sonar.python.coverage.reportpath>cdapplugin/coverage.xml</sonar.python.coverage.reportpath>
<sonar.language>py</sonar.language>
- <sonar.pluginname>python</sonar.pluginname>
- <sonar.inclusions>*/cdapcloudify/**.py</sonar.inclusions>
+ <sonar.pluginname>Python</sonar.pluginname>
+ <sonar.inclusions>cdapcloudify/**/*.py</sonar.inclusions>
+ <sonar.exclusions>cdapcloudify/test/*,cdapcloudify/setup.py</sonar.exclusions>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
diff --git a/dcae-policy/.coveragerc b/dcae-policy/.coveragerc
index 2e600b5..eba9bd0 100644
--- a/dcae-policy/.coveragerc
+++ b/dcae-policy/.coveragerc
@@ -23,7 +23,3 @@ exclude_lines =
if __name__ == .__main__.:
ignore_errors = True
-
-[xml]
-output = coverage-reports/coverage-dcaepolicyplugin.xml
-
diff --git a/dcae-policy/pom.xml b/dcae-policy/pom.xml
index a96f6d2..5f96122 100644
--- a/dcae-policy/pom.xml
+++ b/dcae-policy/pom.xml
@@ -32,21 +32,13 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <sonar.skip>true</sonar.skip>
<sonar.sources>.</sonar.sources>
- <!-- customize the SONARQUBE URL -->
- <!-- sonar.host.url>http://localhost:9000</sonar.host.url -->
- <!-- below are language dependent -->
- <!-- for Python -->
+ <sonar.junit.reportsPath>xunit-results.xml</sonar.junit.reportsPath>
+ <sonar.python.coverage.reportPath>coverage.xml</sonar.python.coverage.reportPath>
<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>
- -->
+ <sonar.exclusions>tests/*,setup.py</sonar.exclusions>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
diff --git a/dcae-policy/tox.ini b/dcae-policy/tox.ini
index b78ba54..40caed5 100644
--- a/dcae-policy/tox.ini
+++ b/dcae-policy/tox.ini
@@ -11,5 +11,7 @@ deps=
pytest-cov
setenv =
PYTHONPATH={toxinidir}
-# recreate = True
-commands=pytest --junitxml xunit-reports/xunit-result-dcaepolicyplugin.xml --cov dcaepolicyplugin --cov-report=xml
+commands=
+ -mkdir logs
+ pytest --junitxml xunit-results.xml --cov dcaepolicyplugin --cov-report xml
+ coverage xml
diff --git a/docker/pom.xml b/docker/pom.xml
index be11078..ebe2f26 100644
--- a/docker/pom.xml
+++ b/docker/pom.xml
@@ -32,21 +32,13 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <sonar.skip>true</sonar.skip>
<sonar.sources>.</sonar.sources>
- <!-- customize the SONARQUBE URL -->
- <!-- sonar.host.url>http://localhost:9000</sonar.host.url -->
- <!-- below are language dependent -->
- <!-- for Python -->
+ <sonar.junit.reportsPath>xunit-results.xml</sonar.junit.reportsPath>
+ <sonar.python.coverage.reportPath>coverage.xml</sonar.python.coverage.reportPath>
<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>
- -->
+ <sonar.exclusions>tests/*,setup.py</sonar.exclusions>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
diff --git a/docker/tox.ini b/docker/tox.ini
index 91f7dc6..5fad68b 100644
--- a/docker/tox.ini
+++ b/docker/tox.ini
@@ -8,4 +8,8 @@ deps=
pytest
coverage
pytest-cov
-commands=pytest --junitxml xunit-results.xml --cov {envsitepackagesdir}/dockerplugin
+setenv=
+ PYTHONPATH={toxinidir}
+commands=
+ pytest --junitxml xunit-results.xml --cov dockerplugin --cov-report xml
+ coverage xml
diff --git a/mvn-phase-lib.sh b/mvn-phase-lib.sh
index 3a41708..a44a206 100755
--- a/mvn-phase-lib.sh
+++ b/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}
@@ -144,7 +141,7 @@ expand_templates()
VALUE=$(echo "$TEMPLATE" | cut -f2 -d'=')
VALUE2=$(echo "$TEMPLATE" | cut -f2 -d'=' |sed 's/\//\\\//g')
set +e
- FILES=$(grep -rl "$KEY")
+ FILES=$(grep -rl "$KEY" .)
set -e
if [ -z "$FILES" ]; then
@@ -167,8 +164,8 @@ expand_templates()
#if [ ! -z "$FILES" ]; then
# echo "====> Resolving template $VALUE to value $VALUE"
- # #CMD="grep -rl \"$VALUE\" | tr '\n' '\0' | xargs -0 sed -i \"s/{{[[:space:]]*$VALUE[[:space:]]*}}/$VALUE/g\""
- # grep -rl "$KEY" | tr '\n' '\0' | xargs -0 sed -i 's/$KEY/$VALUE2/g'
+ # #CMD="grep -rl \"$VALUE\" . | tr '\n' '\0' | xargs -0 sed -i \"s/{{[[:space:]]*$VALUE[[:space:]]*}}/$VALUE/g\""
+ # grep -rl "$KEY" . | tr '\n' '\0' | xargs -0 sed -i 's/$KEY/$VALUE2/g'
# #echo $CMD
# #eval $CMD
#fi
diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh
index 0978017..519e809 100755
--- a/mvn-phase-script.sh
+++ b/mvn-phase-script.sh
@@ -58,10 +58,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}
@@ -105,6 +102,7 @@ compile)
;;
test)
echo "==> test phase script"
+ run_tox_test
;;
package)
echo "==> package phase script"
diff --git a/pom.xml b/pom.xml
index 6b3abba..878f538 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,6 +55,10 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<!-- properties for Pypi server -->
<onap.nexus.pypiserver.baseurl>https://nexus3.onap.org/repository/PyPi</onap.nexus.pypiserver.baseurl>
<onap.nexus.pypiserver.serverid>onap-pypi</onap.nexus.pypiserver.serverid>
+ <!-- customize the SONARQUBE URL -->
+ <sonar.host.url>http://localhost:9000</sonar.host.url>
+ <!-- taken care of in the children -->
+ <sonar.exclusions>**/*.py</sonar.exclusions>
</properties>
<build>
<pluginManagement>
diff --git a/relationships/pom.xml b/relationships/pom.xml
index aba8619..4a1ef79 100644
--- a/relationships/pom.xml
+++ b/relationships/pom.xml
@@ -32,21 +32,13 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <sonar.skip>true</sonar.skip>
<sonar.sources>.</sonar.sources>
- <!-- customize the SONARQUBE URL -->
- <!-- sonar.host.url>http://localhost:9000</sonar.host.url -->
- <!-- below are language dependent -->
- <!-- for Python -->
+ <sonar.junit.reportsPath>xunit-results.xml</sonar.junit.reportsPath>
+ <sonar.python.coverage.reportPath>coverage.xml</sonar.python.coverage.reportPath>
<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>
- -->
+ <sonar.exclusions>tests/*,setup.py</sonar.exclusions>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
diff --git a/relationships/tox.ini b/relationships/tox.ini
index 5d8f4ae..a7157be 100644
--- a/relationships/tox.ini
+++ b/relationships/tox.ini
@@ -8,4 +8,8 @@ deps=
pytest
coverage
pytest-cov
-commands=pytest --junitxml xunit-results.xml --cov {envsitepackagesdir}/relationshipplugin --cov-report=xml
+setenv=
+ PYTHONPATH={toxinidir}
+commands=
+ pytest --junitxml xunit-results.xml --cov relationshipplugin --cov-report xml
+ coverage xml