MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / TestAsyncCache_RedisCache_ServerOnlyTLS

Function TestAsyncCache_RedisCache_ServerOnlyTLS

cache/async_cache_test.go:302–339  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

300}
301
302func 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
341func TestAsyncCache_RedisCache_wrong_instantiation(t *testing.T) {
342 var redisCfg = config.Cache{

Callers

nothing calls this directly

Calls 5

BuildTLSConfigMethod · 0.95
DurationTypeAlias · 0.92
ByteSizeTypeAlias · 0.92
NewAsyncCacheFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected