From 9412d399daa4e119be88353976d869c3d18d9164 Mon Sep 17 00:00:00 2001 From: Timo Tietavainen Date: Tue, 8 Feb 2022 18:44:27 +0200 Subject: [PATCH] Fix reported sdlgo testing coverage at sonarcloud.io 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 Change-Id: Iffea947e55a16306271f0f6dbeb967d3b1bd1cae --- jjb/ric-plt-sdlgo/prescan-sdlgo-go-ubuntu.sh | 4 ++-- jjb/ric-plt-sdlgo/ric-plt-sdlgo.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jjb/ric-plt-sdlgo/prescan-sdlgo-go-ubuntu.sh b/jjb/ric-plt-sdlgo/prescan-sdlgo-go-ubuntu.sh index b9c27b5e..18d4d547 100644 --- a/jjb/ric-plt-sdlgo/prescan-sdlgo-go-ubuntu.sh +++ b/jjb/ric-plt-sdlgo/prescan-sdlgo-go-ubuntu.sh @@ -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" diff --git a/jjb/ric-plt-sdlgo/ric-plt-sdlgo.yaml b/jjb/ric-plt-sdlgo/ric-plt-sdlgo.yaml index 3e2a454d..41592abb 100644 --- a/jjb/ric-plt-sdlgo/ric-plt-sdlgo.yaml +++ b/jjb/ric-plt-sdlgo/ric-plt-sdlgo.yaml @@ -60,11 +60,11 @@ # 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 -- 2.16.6