@@ -69,7 +69,9 @@ class SslIntegrationTests extends TestSupport {
6969
7070 private static final String KEYSTORE = "work/keystore.jks" ;
7171
72- private static File truststoreFile ;
72+ private static File truststoreFile0 ;
73+ private static File truststoreFile1 ;
74+ private static File truststoreFile2 ;
7375
7476 private static File cacertFile ;
7577
@@ -112,12 +114,25 @@ class SslIntegrationTests extends TestSupport {
112114
113115 @ BeforeAll
114116 static void beforeClass () {
115- Path path = createAndSaveTestTruststore ("redis-standalone-1" , Paths .get ("work/tls" ), "changeit" );
116- truststoreFile = path .toFile ();
117+ Path path0 = createAndSaveTestTruststore ("redis-standalone-0" , Paths .get ("redis-standalone-0/work/tls" ), "changeit" );
118+ truststoreFile0 = path0 .toFile ();
119+ cacertFile = envCa (Paths .get ("redis-standalone-0/work/tls" )).toFile ();
120+
121+ Path path = createAndSaveTestTruststore ("redis-standalone-1" , Paths .get ("redis-standalone-1/work/tls" ), "changeit" );
122+ truststoreFile1 = path .toFile ();
117123 cacertFile = envCa (Paths .get ("redis-standalone-1/work/tls" )).toFile ();
118- // do for 6444 and 8444
124+
125+ Path path2 = createAndSaveTestTruststore ("redis-standalone-sentinel-controlled" , Paths .get ("redis-standalone-sentinel-controlled/work/tls" ), "changeit" );
126+ truststoreFile2 = path2 .toFile ();
127+ cacertFile = envCa (Paths .get ("redis-standalone-sentinel-controlled/work/tls" )).toFile ();
128+
129+
130+
119131 assumeTrue (CanConnect .to (TestSettings .host (), sslPort ()), "Assume that stunnel runs on port 6443" );
120- assertThat (truststoreFile ).exists ();
132+ // Maybe we should do a list.
133+ assertThat (truststoreFile0 ).exists ();
134+ assertThat (truststoreFile1 ).exists ();
135+ assertThat (truststoreFile2 ).exists ();
121136 }
122137
123138 @ Test
@@ -134,7 +149,7 @@ void standaloneWithJdkSsl() {
134149
135150 SslOptions sslOptions = SslOptions .builder () //
136151 .jdkSslProvider () //
137- .truststore (truststoreFile , "changeit" ) //
152+ .truststore (truststoreFile1 , "changeit" ) //
138153 .build ();
139154 setOptions (sslOptions );
140155
@@ -146,7 +161,7 @@ void standaloneWithVerifyCaOnly() {
146161
147162 SslOptions sslOptions = SslOptions .builder () //
148163 .jdkSslProvider () //
149- .truststore (truststoreFile , "changeit" ) //
164+ .truststore (truststoreFile0 , "changeit" ) //
150165 .build ();
151166 setOptions (sslOptions );
152167
@@ -157,7 +172,7 @@ void standaloneWithVerifyCaOnly() {
157172 void standaloneWithPemCert () {
158173
159174 SslOptions sslOptions = SslOptions .builder () //
160- .trustManager (cacertFile ) //
175+ .trustManager (envCa ( Paths . get ( "redis-standalone-1/work/tls" )). toFile () ) //
161176 .build ();
162177 setOptions (sslOptions );
163178 verifyConnection (URI_VERIFY );
@@ -168,7 +183,7 @@ void standaloneWithPemCertAndImpossibleTimeout() {
168183
169184 Assertions .setMaxStackTraceElementsDisplayed (30 );
170185 SslOptions sslOptions = SslOptions .builder () //
171- .trustManager (cacertFile ) //
186+ .trustManager (envCa ( Paths . get ( "redis-standalone-1/work/tls" )). toFile () ) //
172187 .build ();
173188 setOptions (sslOptions );
174189 redisClient .setOptions (ClientOptions .builder ().protocolVersion (ProtocolVersion .RESP3 ).sslOptions (sslOptions ).build ());
@@ -187,7 +202,7 @@ void standaloneWithJdkSslUsingTruststoreUrl() throws Exception {
187202
188203 SslOptions sslOptions = SslOptions .builder () //
189204 .jdkSslProvider () //
190- .truststore (truststoreURL ()) //
205+ .truststore (truststoreURL (truststoreFile1 )) //
191206 .build ();
192207 setOptions (sslOptions );
193208
@@ -196,11 +211,11 @@ void standaloneWithJdkSslUsingTruststoreUrl() throws Exception {
196211
197212 @ Test
198213 void standaloneWithClientCertificates () {
199-
214+ //6445
200215 SslOptions sslOptions = SslOptions .builder () //
201216 .jdkSslProvider () //
202217 .keystore (new File (KEYSTORE ), "changeit" .toCharArray ()) //
203- .truststore (truststoreFile , "changeit" ) //
218+ .truststore (truststoreFile1 , "changeit" ) //
204219 .build ();
205220 setOptions (sslOptions );
206221
@@ -212,7 +227,7 @@ void standaloneWithClientCertificatesWithoutKeystore() {
212227
213228 SslOptions sslOptions = SslOptions .builder () //
214229 .jdkSslProvider () //
215- .truststore (truststoreFile , "changeit" ) //
230+ .truststore (truststoreFile0 , "changeit" ) //
216231 .build ();
217232 setOptions (sslOptions );
218233
@@ -224,7 +239,7 @@ void standaloneWithJdkSslUsingTruststoreUrlWithWrongPassword() throws Exception
224239
225240 SslOptions sslOptions = SslOptions .builder () //
226241 .jdkSslProvider () //
227- .truststore (truststoreURL (), "knödel" ) //
242+ .truststore (truststoreURL (truststoreFile0 ), "knödel" ) //
228243 .build ();
229244 setOptions (sslOptions );
230245
@@ -249,7 +264,7 @@ void standaloneWithOpenSsl() {
249264
250265 SslOptions sslOptions = SslOptions .builder () //
251266 .openSslProvider () //
252- .truststore (truststoreFile , "changeit" ) //
267+ .truststore (truststoreFile0 , "changeit" ) //
253268 .build ();
254269 setOptions (sslOptions );
255270
@@ -302,7 +317,7 @@ void masterSlaveWithJdkSsl() {
302317
303318 SslOptions sslOptions = SslOptions .builder () //
304319 .jdkSslProvider () //
305- .truststore (truststoreFile , "changeit" ) //
320+ .truststore (truststoreFile2 , "changeit" ) //
306321 .build ();
307322 setOptions (sslOptions );
308323
@@ -314,7 +329,7 @@ void masterSlaveWithJdkSslUsingTruststoreUrl() throws Exception {
314329
315330 SslOptions sslOptions = SslOptions .builder () //
316331 .jdkSslProvider () //
317- .truststore (truststoreURL ()) //
332+ .truststore (truststoreURL (truststoreFile2 )) //
318333 .build ();
319334 setOptions (sslOptions );
320335
@@ -326,7 +341,7 @@ void masterSlaveWithJdkSslUsingTruststoreUrlWithWrongPassword() throws Exception
326341
327342 SslOptions sslOptions = SslOptions .builder () //
328343 .jdkSslProvider () //
329- .truststore (truststoreURL (), "knödel" ) //
344+ .truststore (truststoreURL (truststoreFile0 ), "knödel" ) //
330345 .build ();
331346 setOptions (sslOptions );
332347
@@ -367,7 +382,7 @@ void masterSlaveSslWithOneInvalidHostWillSucceed() {
367382
368383 SslOptions sslOptions = SslOptions .builder () //
369384 .jdkSslProvider () //
370- .truststore (truststoreFile , "changeit" ) //
385+ .truststore (truststoreFile2 , "changeit" ) //
371386 .build ();
372387 setOptions (sslOptions );
373388
@@ -379,7 +394,7 @@ void masterSlaveSslWithAllInvalidHostsWillFail() {
379394
380395 SslOptions sslOptions = SslOptions .builder () //
381396 .jdkSslProvider () //
382- .truststore (truststoreFile , "changeit" ) //
397+ .truststore (truststoreFile0 , "changeit" ) //
383398 .build ();
384399 setOptions (sslOptions );
385400
@@ -419,7 +434,7 @@ private static List<RedisURI> sslUris(IntStream masterSlaveOffsets,
419434 .map (builderCustomizer ).map (RedisURI .Builder ::build ).collect (Collectors .toList ());
420435 }
421436
422- private URL truststoreURL () throws MalformedURLException {
437+ private URL truststoreURL (File truststoreFile ) throws MalformedURLException {
423438 return truststoreFile .toURI ().toURL ();
424439 }
425440
0 commit comments