Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
25 lines
690 B
Go
25 lines
690 B
Go
package platform
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/config"
|
|
)
|
|
|
|
func TestFailoverOptionsTakesMasterAuthFromURL(t *testing.T) {
|
|
s := config.Sentinel{Master: "mymaster", Addrs: []string{"s1:26379", "s2:26379"}, Password: "sentinelpw"}
|
|
fo, err := failoverOptions("rediss://app:masterpw@ignored:6379/3", s)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if fo.Password != "masterpw" || fo.Username != "app" || fo.DB != 3 {
|
|
t.Fatalf("master auth not applied: %+v", fo)
|
|
}
|
|
if fo.SentinelPassword != "sentinelpw" || len(fo.SentinelAddrs) != 2 {
|
|
t.Fatalf("sentinel settings lost: %+v", fo)
|
|
}
|
|
if fo.TLSConfig == nil {
|
|
t.Fatal("rediss scheme must enable TLS")
|
|
}
|
|
}
|