Skip to content

Commit 7decf55

Browse files
committed
e2e fix
1 parent 8e4ea91 commit 7decf55

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

maintnotifications/e2e/main_test.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,21 @@ func TestMain(m *testing.M) {
2626
return
2727
}
2828

29-
faultInjector, faultInjectorCleanup, err = CreateTestFaultInjectorWithCleanup()
30-
if err != nil {
31-
panic("Failed to create fault injector: " + err.Error())
29+
// Only create fault injector if we're not using the unified injector
30+
// The unified injector tests use NewNotificationInjector() which auto-detects the mode
31+
// and doesn't require the global faultInjector variable
32+
// We can detect unified injector mode by checking if REDIS_ENDPOINTS_CONFIG_PATH is NOT set
33+
// (which means we're using the proxy mock mode)
34+
if os.Getenv("REDIS_ENDPOINTS_CONFIG_PATH") != "" {
35+
// Real fault injector mode - create the global fault injector
36+
faultInjector, faultInjectorCleanup, err = CreateTestFaultInjectorWithCleanup()
37+
if err != nil {
38+
panic("Failed to create fault injector: " + err.Error())
39+
}
40+
defer faultInjectorCleanup()
41+
} else {
42+
log.Println("Using proxy mock mode - skipping global fault injector setup")
3243
}
33-
defer faultInjectorCleanup()
3444

3545
// use log collector to capture logs from redis clients
3646
logCollector = NewTestLogCollector()

maintnotifications/e2e/scenario_unified_injector_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package e2e
33
import (
44
"context"
55
"fmt"
6+
"sync"
67
"sync/atomic"
78
"testing"
89
"time"
@@ -243,10 +244,13 @@ func TestUnifiedInjector_SMIGRATED(t *testing.T) {
243244
time.Sleep(2 * time.Second)
244245

245246
// Count how many nodes the client knows about
247+
var nodeAddrsMu sync.Mutex
246248
nodeAddrs := make(map[string]bool)
247249
client.ForEachShard(ctx, func(ctx context.Context, nodeClient *redis.Client) error {
248250
addr := nodeClient.Options().Addr
251+
nodeAddrsMu.Lock()
249252
nodeAddrs[addr] = true
253+
nodeAddrsMu.Unlock()
250254
t.Logf("Client knows about node: %s", addr)
251255
return nil
252256
})

0 commit comments

Comments
 (0)