Downloading and running SonarQube in local system

With help from Sam, I was able to have Sonar tool -- similar to the one we have in sonar.opendaylight.org -- running locally. This is a quick blurb on the details for doing that. In this particular case, I'm using ODL's ovsdb project.

1) Download and install Sonar

Go to: http://www.sonarqube.org/downloads/

wget --quiet http://downloads.sonarsource.com/sonarqube/sonarqube-5.1.1.zip
unzip sonarqube-5.1.1.zip > /dev/null

2) Start Sonar

MY_OS='macosx-universal-64' ; ./sonarqube-5.1.1/bin/${MY_OS}/sonar.sh start

Using your browser, go to http://localhost:9000 and login

login

3) Grab OVSDB and build

See wiki for better details on installing

git clone https://git.opendaylight.org/gerrit/ovsdb ovsdb.git

4) Generate unit test for sonar data from OVSDB project.

Note we bulid twice, once to grab all needed dependencies and again to build against sonar.

cd ovsdb.git && mvn clean install -DskipTests
mvn verify -Pcoverage,jenkins -Dsonar.host.url=http://localhost:9000 sonar:sonar

5) Add Unit Test Coverage widget in Sonar

5.1) Select Dashboard, make sure you see ovsdb project, and select configure widgets.

login

5.2) Scroll list of widgets and locate Unit Test Coverage and click Add Widget. On field below, fill in ovsdb and click save.

login

6) Generate integration test for sonar data from OVSDB project

In order to run integration test coverage, you will need a running instance of OVS, so OVSDB can talk to. See this link and this link for different methods of running OVS.

Once OVS is running, do this from the integration directory in ovsdb.git

cd ./integrationtest && \
mvn verify -Pintegrationtest,coverage,jenkins -Dsonar.host.url=http://localhost:9000 \
-Dovsdbserver.ipaddress=${OVS_IP} -Dovsdbserver.port=6640 -nsu -o sonar:sonar

cd ../southbound/southbound-it && \
mvn verify -Pintegrationtest,coverage,jenkins -Dsonar.host.url=http://localhost:9000 \
-Dovsdbserver.ipaddress=${OVS_IP} -Dovsdbserver.port=6640 -nsu -o sonar:sonar

7) Add Integration test Coverage widget in Sonar

Repeat step 5 above except, that the widget added is called Integration Tests Coverage.


Comments

comments powered by Disqus