mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-06-06 22:49:43 +00:00
e64fc7f730
* Add redis support for distributed caching * Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * ... and another all nighter. * fixup! ... and another all nighter. * fixup! fixup! ... and another all nighter. * fixup! fixup! fixup! ... and another all nighter. * Resolve issue #85 by adding ability to set custom claims in JWT tokens * Remove redundant validation in auth middleware ( issue #89 ) * Add ability to set cookie prefix for session cookies ( #87 ) * fixup! Add ability to set cookie prefix for session cookies ( #87 ) * Add ability to set cookie max age - issue #91 * Potential fix for code scanning alert no. 10: Size computation for allocation may overflow Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fixup! Merge main into 0.8.0-redis: resolve conflicts --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
60 lines
1.5 KiB
Go
60 lines
1.5 KiB
Go
//go:build !yaegi
|
|
|
|
package backends
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// TestDefaultHybridConfig verifies the default hybrid configuration
|
|
func TestDefaultHybridConfig(t *testing.T) {
|
|
redisAddr := "localhost:6379"
|
|
|
|
config := DefaultHybridConfig(redisAddr)
|
|
|
|
require.NotNil(t, config)
|
|
|
|
// Verify top-level config
|
|
assert.Equal(t, BackendTypeHybrid, config.Type)
|
|
assert.True(t, config.AsyncWrites)
|
|
assert.True(t, config.EnableMetrics)
|
|
|
|
// Verify L1 (memory) config
|
|
require.NotNil(t, config.L1Config)
|
|
assert.Equal(t, BackendTypeMemory, config.L1Config.Type)
|
|
assert.Equal(t, 500, config.L1Config.MaxSize)
|
|
assert.Equal(t, int64(10*1024*1024), config.L1Config.MaxMemoryBytes) // 10MB
|
|
assert.Equal(t, 1*time.Minute, config.L1Config.CleanupInterval)
|
|
|
|
// Verify L2 (Redis) config exists
|
|
require.NotNil(t, config.L2Config)
|
|
assert.Equal(t, BackendTypeRedis, config.L2Config.Type)
|
|
}
|
|
|
|
func TestDefaultHybridConfig_DifferentRedisAddr(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
redisAddr string
|
|
}{
|
|
{"localhost", "localhost:6379"},
|
|
{"remote host", "redis.example.com:6379"},
|
|
{"IP address", "192.168.1.100:6379"},
|
|
{"custom port", "localhost:6380"},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
config := DefaultHybridConfig(tt.redisAddr)
|
|
|
|
require.NotNil(t, config)
|
|
assert.Equal(t, BackendTypeHybrid, config.Type)
|
|
assert.NotNil(t, config.L1Config)
|
|
assert.NotNil(t, config.L2Config)
|
|
})
|
|
}
|
|
}
|