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 -- 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:

wget --quiet
unzip > /dev/null

2) Start Sonar

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

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


3) Grab OVSDB and build

See wiki for better details on installing

git clone 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 sonar:sonar

5) Add Unit Test Coverage widget in Sonar

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


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


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 \
-Dovsdbserver.ipaddress=${OVS_IP} -Dovsdbserver.port=6640 -nsu -o sonar:sonar

cd ../southbound/southbound-it && \
mvn verify -Pintegrationtest,coverage,jenkins \
-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 powered by Disqus