mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 06:16:37 +08:00
0548a8a5d4
Default Redis maintenance notification negotiation to disabled and apply the startup-only setting to both platform and Asynq clients.
26 lines
640 B
Go
26 lines
640 B
Go
package db
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/redis/go-redis/v9/maintnotifications"
|
|
)
|
|
|
|
func TestRedisMaintNotificationsConfig(t *testing.T) {
|
|
for _, test := range []struct {
|
|
name string
|
|
enabled bool
|
|
want maintnotifications.Mode
|
|
}{
|
|
{name: "disabled by default", enabled: false, want: maintnotifications.ModeDisabled},
|
|
{name: "auto when enabled", enabled: true, want: maintnotifications.ModeAuto},
|
|
} {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
cfg := redisMaintNotificationsConfig(test.enabled)
|
|
if cfg.Mode != test.want {
|
|
t.Fatalf("maintenance notifications mode = %v, want %v", cfg.Mode, test.want)
|
|
}
|
|
})
|
|
}
|
|
}
|