File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff 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 ()
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package e2e
33import (
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 })
You can’t perform that action at this time.
0 commit comments