@@ -299,6 +299,45 @@ func TestAsyncCache_RedisCache_TLS(t *testing.T) {
299299 }
300300}
301301
302+ func TestAsyncCache_RedisCache_ServerOnlyTLS (t * testing.T ) {
303+ serverCfg := config.TLS {
304+ CertFile : "../testdata/example.com.cert" ,
305+ KeyFile : "../testdata/example.com.key" ,
306+ }
307+
308+ clientCfg := config.TLS {
309+ InsecureSkipVerify : true ,
310+ }
311+
312+ tlsServerConfig , err := serverCfg .BuildTLSConfig (nil )
313+ if err != nil {
314+ t .Fatalf ("could not build tls config: %s" , err )
315+ }
316+ s := miniredis .NewMiniRedis ()
317+ if err := s .StartTLS (tlsServerConfig ); err != nil {
318+ t .Fatalf ("could not start miniredis: %s" , err .Error ())
319+ // not reached
320+ }
321+ t .Cleanup (s .Close )
322+
323+ var redisCfg = config.Cache {
324+ Name : "test" ,
325+ Mode : "redis" ,
326+ Redis : config.RedisCacheConfig {
327+ EnableTLS : true ,
328+ TLS : clientCfg ,
329+ Addresses : []string {s .Addr ()},
330+ },
331+ Expire : config .Duration (cacheTTL ),
332+ MaxPayloadSize : config .ByteSize (100000000 ),
333+ }
334+
335+ _ , err = NewAsyncCache (redisCfg , 1 * time .Second )
336+ if err != nil {
337+ t .Fatalf ("could not instanciate redis async cache because of the following error: %s" , err .Error ())
338+ }
339+ }
340+
302341func TestAsyncCache_RedisCache_wrong_instantiation (t * testing.T ) {
303342 var redisCfg = config.Cache {
304343 Name : "test" ,
0 commit comments