mirror of
https://github.com/redis/go-redis.git
synced 2025-09-10 07:11:50 +03:00
[CAE-1072] Hitless Upgrades (#3447)
* feat(hitless): Introduce handlers for hitless upgrades This commit includes all the work on hitless upgrades with the addition of: - Pubsub Pool - Examples - Refactor of push - Refactor of pool (using atomics for most things) - Introducing of hooks in pool --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
59
logging/logging_test.go
Normal file
59
logging/logging_test.go
Normal file
@@ -0,0 +1,59 @@
|
||||
package logging
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestLogLevel_String(t *testing.T) {
|
||||
tests := []struct {
|
||||
level LogLevel
|
||||
expected string
|
||||
}{
|
||||
{LogLevelError, "ERROR"},
|
||||
{LogLevelWarn, "WARN"},
|
||||
{LogLevelInfo, "INFO"},
|
||||
{LogLevelDebug, "DEBUG"},
|
||||
{LogLevel(99), "UNKNOWN"},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
if got := test.level.String(); got != test.expected {
|
||||
t.Errorf("LogLevel(%d).String() = %q, want %q", test.level, got, test.expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLogLevel_IsValid(t *testing.T) {
|
||||
tests := []struct {
|
||||
level LogLevel
|
||||
expected bool
|
||||
}{
|
||||
{LogLevelError, true},
|
||||
{LogLevelWarn, true},
|
||||
{LogLevelInfo, true},
|
||||
{LogLevelDebug, true},
|
||||
{LogLevel(-1), false},
|
||||
{LogLevel(4), false},
|
||||
{LogLevel(99), false},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
if got := test.level.IsValid(); got != test.expected {
|
||||
t.Errorf("LogLevel(%d).IsValid() = %v, want %v", test.level, got, test.expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLogLevelConstants(t *testing.T) {
|
||||
// Test that constants have expected values
|
||||
if LogLevelError != 0 {
|
||||
t.Errorf("LogLevelError = %d, want 0", LogLevelError)
|
||||
}
|
||||
if LogLevelWarn != 1 {
|
||||
t.Errorf("LogLevelWarn = %d, want 1", LogLevelWarn)
|
||||
}
|
||||
if LogLevelInfo != 2 {
|
||||
t.Errorf("LogLevelInfo = %d, want 2", LogLevelInfo)
|
||||
}
|
||||
if LogLevelDebug != 3 {
|
||||
t.Errorf("LogLevelDebug = %d, want 3", LogLevelDebug)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user