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

Function TestAsyncCache_RedisCache_TLS

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

Source from the content-addressed store, hash-verified

265}
266
267func 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
302func TestAsyncCache_RedisCache_ServerOnlyTLS(t *testing.T) {
303 serverCfg := config.TLS{

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