Fix reported sdlgo testing coverage at sonarcloud.io 14/7714/1
authorTimo Tietavainen <timo.tietavainen@nokia.com>
Tue, 8 Feb 2022 16:44:27 +0000 (18:44 +0200)
committerTimo Tietavainen <timo.tietavainen@nokia.com>
Tue, 8 Feb 2022 16:44:27 +0000 (18:44 +0200)
Add more sdlgo source code files to be part of the coverage measurement.
Exclude also some files what shouldn't be visible in coverage report,
like example, mock and testing files.

Issue-Id: RIC-887

Signed-off-by: Timo Tietavainen <timo.tietavainen@nokia.com>
Change-Id: Iffea947e55a16306271f0f6dbeb967d3b1bd1cae

jjb/ric-plt-sdlgo/prescan-sdlgo-go-ubuntu.sh
jjb/ric-plt-sdlgo/ric-plt-sdlgo.yaml

index b9c27b5..18d4d54 100644 (file)
@@ -58,11 +58,11 @@ hash=$(git rev-parse --short HEAD || true)
 
 # Build
 
-go build -a -installsuffix cgo -ldflags "-X main.Version=$tag -X main.Hash=$hash" -o ./cmd/*.go
+go build ./...
 
 # Execute UT and measure coverage
 
-go test . -v -coverprofile cover.out || true
+go test ./... -v -coverprofile cover.out || true
 
 echo "--> build_sdlgo_ubuntu.sh ends"
 
index 3e2a454..41592ab 100644 (file)
         # Source
         sonar.sources=.
         # Unit tests
-        sonar.go.coverage.reportPaths=./cover.out,/internal/sdlgoredis/cover.out
+        sonar.go.coverage.reportPaths=**/cover.out
         # Inclusions
         sonar.inclusions=**/*.go
         # Exclusions
-        sonar.exclusions=**/*_test.go
+        sonar.exclusions=cmd/**.go,example/**.go,internal/mocks/**.go,**/*_test.go
     jobs:
       - gerrit-sonar-prescan-script