1
0
mirror of https://github.com/redis/go-redis.git synced 2025-10-20 09:52:25 +03:00

feat(e2e-testing): maintnotifications e2e and refactor (#3526)

* e2e wip

* cleanup

* remove unused fault injector mock

* errChan in test

* remove log messages tests

* cleanup log messages

* s/hitless/maintnotifications/

* fix moving when none

* better logs

* test with second client after action has started

* Fixes

Signed-off-by: Elena Kolevska <elena@kolevska.com>

* Test fix

Signed-off-by: Elena Kolevska <elena@kolevska.com>

* feat(e2e-test): Extended e2e tests

* imroved e2e test resiliency

---------

Signed-off-by: Elena Kolevska <elena@kolevska.com>
Co-authored-by: Elena Kolevska <elena@kolevska.com>
Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com>
Co-authored-by: Hristo Temelski <hristo.temelski@redis.com>
This commit is contained in:
Nedyalko Dyakov
2025-09-26 19:17:09 +03:00
committed by GitHub
parent e6e52bc735
commit 75ddeb3d5a
52 changed files with 5848 additions and 570 deletions

View File

@@ -9,8 +9,8 @@ import (
"time"
"github.com/redis/go-redis/v9"
"github.com/redis/go-redis/v9/hitless"
"github.com/redis/go-redis/v9/logging"
"github.com/redis/go-redis/v9/maintnotifications"
)
var ctx = context.Background()
@@ -19,24 +19,28 @@ var cntSuccess atomic.Int64
var startTime = time.Now()
// This example is not supposed to be run as is. It is just a test to see how pubsub behaves in relation to pool management.
// It was used to find regressions in pool management in hitless mode.
// It was used to find regressions in pool management in maintnotifications mode.
// Please don't use it as a reference for how to use pubsub.
func main() {
startTime = time.Now()
wg := &sync.WaitGroup{}
rdb := redis.NewClient(&redis.Options{
Addr: ":6379",
HitlessUpgradeConfig: &redis.HitlessUpgradeConfig{
Mode: hitless.MaintNotificationsEnabled,
MaintNotificationsConfig: &maintnotifications.Config{
Mode: maintnotifications.ModeEnabled,
EndpointType: maintnotifications.EndpointTypeExternalIP,
HandoffTimeout: 10 * time.Second,
RelaxedTimeout: 10 * time.Second,
PostHandoffRelaxedDuration: 10 * time.Second,
},
})
_ = rdb.FlushDB(ctx).Err()
hitlessManager := rdb.GetHitlessManager()
if hitlessManager == nil {
panic("hitless manager is nil")
maintnotificationsManager := rdb.GetMaintNotificationsManager()
if maintnotificationsManager == nil {
panic("maintnotifications manager is nil")
}
loggingHook := hitless.NewLoggingHook(logging.LogLevelDebug)
hitlessManager.AddNotificationHook(loggingHook)
loggingHook := maintnotifications.NewLoggingHook(int(logging.LogLevelDebug))
maintnotificationsManager.AddNotificationHook(loggingHook)
go func() {
for {