Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
inf2381 committed Jan 10, 2025
1 parent 293cba1 commit 1b00aaf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/sonarExecuteScan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ func TestRunSonar(t *testing.T) {
PullRequestProvider: "GitHub",
}
fileUtilsExists = mockFileUtilsExists(true)
os.Setenv("SONAR_SCANNER_OPTS", "-Xmx42m")
// test
err := runSonar(options, &mockDownloadClient, &mockRunner, apiClient, &mock.FilesMock{}, &sonarExecuteScanInflux{})
// assert
Expand All @@ -184,7 +185,7 @@ func TestRunSonar(t *testing.T) {
assert.Contains(t, sonar.options, "-Dsonar.organization=SAP")
assert.Contains(t, sonar.environment, "SONAR_HOST_URL="+sonarServerURL)
assert.Contains(t, sonar.environment, "SONAR_TOKEN=secret-ABC")
assert.Contains(t, sonar.environment, "SONAR_SCANNER_OPTS=-Djavax.net.ssl.trustStore="+filepath.Join(getWorkingDir(), ".certificates", "cacerts")+" -Djavax.net.ssl.trustStorePassword=changeit")
assert.Contains(t, sonar.environment, "SONAR_SCANNER_OPTS=-Xmx42m -Djavax.net.ssl.trustStore="+filepath.Join(getWorkingDir(), ".certificates", "cacerts")+" -Djavax.net.ssl.trustStorePassword=changeit")
})
t.Run("with custom options", func(t *testing.T) {
// init
Expand Down

0 comments on commit 1b00aaf

Please sign in to comment.