fixup! fixup! Fix: Redis connection for tests.

This commit is contained in:
2024-06-11 11:49:50 +01:00
parent 44cd694086
commit d05172294c
3 changed files with 8 additions and 7 deletions
+4
View File
@@ -33,6 +33,10 @@ func NewClient(redisClientConfig *RedisClientConfig) *RedisConfig {
}),
ctx: context.Background(),
}
_, err := c.client.Ping(c.ctx).Result()
if err != nil {
panic(err)
}
return c
}
+2 -3
View File
@@ -15,10 +15,9 @@ type RedisConfigSuite struct {
}
func (suite *RedisConfigSuite) SetupTest() {
redis_host := envutil.Getenv("REDIS_HOST", "localhost")
redis_port := envutil.Getenv("REDIS_PORT", "6379")
redis_server := envutil.Getenv("REDIS_SERVER", "localhost:6379")
suite.redisConfig = NewClient(&RedisClientConfig{
RedisServer: redis_host + ":" + redis_port,
RedisServer: redis_server,
RedisPassword: "",
RedisDB: 0,
})
+2 -4
View File
@@ -49,11 +49,9 @@ func (suite *Tests) Test_cacheLookupInmemory() {
}
func (suite *Tests) Test_cacheLookupRedis() {
redis_host := envutil.Getenv("REDIS_HOST", "localhost")
redis_port := envutil.Getenv("REDIS_PORT", "6379")
redis_server := envutil.Getenv("REDIS_SERVER", "localhost:6379")
cfg.Cache.Client = libpack_redis.NewClient(&libpack_redis.RedisClientConfig{
RedisServer: redis_host + ":" + redis_port,
RedisServer: redis_server,
RedisPassword: "",
RedisDB: 0,
})