mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-05-21 22:33:38 +02:00
* feat: readiness check * fix: no need for query param * docs: add a note * chore: move the readyness check to its own endpoint * docs(cr): add godoc Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
36 lines
830 B
Go
36 lines
830 B
Go
package redis_test
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/go-redis/redis/v9"
|
|
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/logger"
|
|
. "github.com/onsi/ginkgo"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
// wrappedRedisLogger wraps a logger so that we can coerce the logger to
|
|
// fit the expected signature for go-redis logging
|
|
type wrappedRedisLogger struct {
|
|
*log.Logger
|
|
}
|
|
|
|
func (l *wrappedRedisLogger) Printf(_ context.Context, format string, v ...interface{}) {
|
|
l.Logger.Printf(format, v...)
|
|
}
|
|
|
|
func TestRedis(t *testing.T) {
|
|
logger.SetOutput(GinkgoWriter)
|
|
logger.SetErrOutput(GinkgoWriter)
|
|
|
|
redisLogger := &wrappedRedisLogger{Logger: log.New(os.Stderr, "redis: ", log.LstdFlags|log.Lshortfile)}
|
|
redisLogger.SetOutput(GinkgoWriter)
|
|
redis.SetLogger(redisLogger)
|
|
|
|
RegisterFailHandler(Fail)
|
|
RunSpecs(t, "Redis")
|
|
}
|