aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test/java/org/sonar/scanner
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2024-09-27 16:27:04 +0200
committersonartech <sonartech@sonarsource.com>2024-09-27 20:02:48 +0000
commit93ca857eaa612624a932a87b50f610f7f7954138 (patch)
tree4c48699a1cbb45b0d9f0e93ef9efb0f5a471998b /sonar-scanner-engine/src/test/java/org/sonar/scanner
parent1fb4fa71017a200b11e5234db82885eb88b72499 (diff)
downloadsonarqube-93ca857eaa612624a932a87b50f610f7f7954138.tar.gz
sonarqube-93ca857eaa612624a932a87b50f610f7f7954138.zip
SONAR-23013 Improve coverage
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/scanner')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/http/ScannerWsClientProviderTest.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/http/ScannerWsClientProviderTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/http/ScannerWsClientProviderTest.java
index e605999ddd3..3aea5460db9 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/http/ScannerWsClientProviderTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/http/ScannerWsClientProviderTest.java
@@ -30,6 +30,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
+import nl.altindag.ssl.exception.GenericKeyStoreException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Tag;
@@ -319,6 +320,19 @@ class ScannerWsClientProviderTest {
assertThat(r.content()).isEqualTo("Success");
}
}
+
+ @Test
+ void it_should_fail_if_invalid_truststore_password() {
+ scannerProps.put("sonar.host.url", sonarqubeMock.baseUrl());
+ scannerProps.put("sonar.scanner.truststorePath", toPath(requireNonNull(ScannerWsClientProviderTest.class.getResource("/ssl/client-truststore.p12"))).toString());
+ scannerProps.put("sonar.scanner.truststorePassword", "wrong_password");
+
+ var scannerPropsObj = new ScannerProperties(scannerProps);
+ var thrown = assertThrows(GenericKeyStoreException.class,
+ () -> underTest.provide(scannerPropsObj, env, GLOBAL_ANALYSIS_MODE, system2, ANALYSIS_WARNINGS, sonarUserHome));
+
+ assertThat(thrown).hasStackTraceContaining("Unable to read truststore");
+ }
}
@Nested