mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-30 05:59:39 +02:00
Translate verbose to sonar binary verbose flag (#3567)
* Translate Piper verbose to sonar bin flag * Add test
This commit is contained in:
parent
b599d6f9fa
commit
b75db369d0
@ -137,6 +137,9 @@ func runSonar(config sonarExecuteScanOptions, client piperhttp.Downloader, runne
|
||||
}
|
||||
sonar.addOption("sonar.projectVersion=" + version)
|
||||
}
|
||||
if GeneralConfig.Verbose {
|
||||
sonar.addOption("sonar.verbose=true")
|
||||
}
|
||||
if len(config.ProjectKey) > 0 {
|
||||
sonar.addOption("sonar.projectKey=" + config.ProjectKey)
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ func TestRunSonar(t *testing.T) {
|
||||
filepath.Join("target", "classes")))
|
||||
assert.Contains(t, sonar.options, "-Dsonar.java.binaries=user/provided")
|
||||
})
|
||||
t.Run("projectKey, coverageExclusions, m2Path", func(t *testing.T) {
|
||||
t.Run("projectKey, coverageExclusions, m2Path, verbose", func(t *testing.T) {
|
||||
// init
|
||||
tmpFolder, err := ioutil.TempDir(".", "test-sonar-")
|
||||
require.NoError(t, err)
|
||||
@ -319,6 +319,8 @@ func TestRunSonar(t *testing.T) {
|
||||
CoverageExclusions: []string{"one", "**/two", "three**"},
|
||||
PullRequestProvider: "GitHub",
|
||||
}
|
||||
GeneralConfig.Verbose = true
|
||||
defer func() { GeneralConfig.Verbose = false }()
|
||||
fileUtilsExists = mockFileUtilsExists(true)
|
||||
defer func() {
|
||||
fileUtilsExists = FileUtils.FileExists
|
||||
@ -331,6 +333,7 @@ func TestRunSonar(t *testing.T) {
|
||||
assert.Contains(t, sonar.options, fmt.Sprintf("-Dsonar.java.libraries=%s",
|
||||
filepath.Join("my/custom/m2", "**")))
|
||||
assert.Contains(t, sonar.options, "-Dsonar.coverage.exclusions=one,**/two,three**")
|
||||
assert.Contains(t, sonar.options, "-Dsonar.verbose=true")
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user