(t *testing.T)
| 265 | } |
| 266 | |
| 267 | func TestAsyncCache_RedisCache_TLS(t *testing.T) { |
| 268 | cfg := config.TLS{ |
| 269 | CertFile: "../testdata/example.com.cert", |
| 270 | KeyFile: "../testdata/example.com.key", |
| 271 | InsecureSkipVerify: true, |
| 272 | } |
| 273 | |
| 274 | tlsConfig, err := cfg.BuildTLSConfig(nil) |
| 275 | if err != nil { |
| 276 | t.Fatalf("could not build tls config: %s", err) |
| 277 | } |
| 278 | s := miniredis.NewMiniRedis() |
| 279 | if err := s.StartTLS(tlsConfig); err != nil { |
| 280 | t.Fatalf("could not start miniredis: %s", err.Error()) |
| 281 | // not reached |
| 282 | } |
| 283 | t.Cleanup(s.Close) |
| 284 | |
| 285 | var redisCfg = config.Cache{ |
| 286 | Name: "test", |
| 287 | Mode: "redis", |
| 288 | Redis: config.RedisCacheConfig{ |
| 289 | TLS: cfg, |
| 290 | Addresses: []string{s.Addr()}, |
| 291 | }, |
| 292 | Expire: config.Duration(cacheTTL), |
| 293 | MaxPayloadSize: config.ByteSize(100000000), |
| 294 | } |
| 295 | |
| 296 | _, err = NewAsyncCache(redisCfg, 1*time.Second) |
| 297 | if err != nil { |
| 298 | t.Fatalf("could not instanciate redis async cache because of the following error: %s", err.Error()) |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | func TestAsyncCache_RedisCache_ServerOnlyTLS(t *testing.T) { |
| 303 | serverCfg := config.TLS{ |
nothing calls this directly
no test coverage detected