feat(platform): support redis sentinel for failover
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
dbae2870bc
commit
2bd3d0a18e
5 files changed
+110
-13
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidateRedisModes(t *testing.T) {
|
||||
base := Common{Edition: EditionSelfHosted, DatabaseURL: "postgres://x"}
|
||||
|
||||
cases := []struct {
|
||||
name string
|
||||
mod func(*Common)
|
||||
ok bool
|
||||
}{
|
||||
{"standalone", func(c *Common) { c.RedisURL = "redis://r" }, true},
|
||||
{"nothing", func(c *Common) {}, false},
|
||||
{"sentinel", func(c *Common) { c.RedisSentinel = Sentinel{Master: "m", Addrs: []string{"s:26379"}} }, true},
|
||||
{"sentinel without addrs", func(c *Common) { c.RedisSentinel = Sentinel{Master: "m"} }, false},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
c := base
|
||||
tc.mod(&c)
|
||||
if err := c.Validate(); (err == nil) != tc.ok {
|
||||
t.Errorf("%s: err=%v", tc.name, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user