From 1b00aaf11a91e917478124001db71692a8415ff0 Mon Sep 17 00:00:00 2001 From: Marc Bormeth Date: Fri, 10 Jan 2025 15:07:49 +0100 Subject: [PATCH] Add tests --- cmd/sonarExecuteScan_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/sonarExecuteScan_test.go b/cmd/sonarExecuteScan_test.go index 0031d0f524..1c7159bbfb 100644 --- a/cmd/sonarExecuteScan_test.go +++ b/cmd/sonarExecuteScan_test.go @@ -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 @@ -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