@@ -32,7 +32,7 @@ func TestPushNotifications(t *testing.T) {
3232 var status * ActionStatusResponse
3333
3434 var p = func (format string , args ... interface {}) {
35- format = "[%s] " + format
35+ format = "[%s][PUSH-NOTIFICATIONS] " + format
3636 ts := time .Now ().Format ("15:04:05.000" )
3737 args = append ([]interface {}{ts }, args ... )
3838 t .Logf (format , args ... )
@@ -41,12 +41,20 @@ func TestPushNotifications(t *testing.T) {
4141 var errorsDetected = false
4242 var e = func (format string , args ... interface {}) {
4343 errorsDetected = true
44- format = "[%s][ERROR] " + format
44+ format = "[%s][PUSH-NOTIFICATIONS][ ERROR] " + format
4545 ts := time .Now ().Format ("15:04:05.000" )
4646 args = append ([]interface {}{ts }, args ... )
4747 t .Errorf (format , args ... )
4848 }
4949
50+ var ef = func (format string , args ... interface {}) {
51+ errorsDetected = true
52+ format = "[%s][PUSH-NOTIFICATIONS][ERROR] " + format
53+ ts := time .Now ().Format ("15:04:05.000" )
54+ args = append ([]interface {}{ts }, args ... )
55+ t .Fatalf (format , args ... )
56+ }
57+
5058 logCollector .ClearLogs ()
5159 defer func () {
5260 if dump {
@@ -61,14 +69,14 @@ func TestPushNotifications(t *testing.T) {
6169 // Create client factory from configuration
6270 factory , err := CreateTestClientFactory ("standalone" )
6371 if err != nil {
64- t .Skipf ("Enterprise cluster not available, skipping push notification tests: %v" , err )
72+ t .Skipf ("[PUSH-NOTIFICATIONS][SKIP] Enterprise cluster not available, skipping push notification tests: %v" , err )
6573 }
6674 endpointConfig := factory .GetConfig ()
6775
6876 // Create fault injector
6977 faultInjector , err := CreateTestFaultInjector ()
7078 if err != nil {
71- t . Fatalf ("Failed to create fault injector: %v" , err )
79+ ef ("Failed to create fault injector: %v" , err )
7280 }
7381
7482 minIdleConns := 5
@@ -91,7 +99,7 @@ func TestPushNotifications(t *testing.T) {
9199 ClientName : "push-notification-test-client" ,
92100 })
93101 if err != nil {
94- t . Fatalf ("Failed to create client: %v" , err )
102+ ef ("Failed to create client: %v" , err )
95103 }
96104
97105 defer func () {
@@ -116,7 +124,7 @@ func TestPushNotifications(t *testing.T) {
116124 // Verify initial connectivity
117125 err = client .Ping (ctx ).Err ()
118126 if err != nil {
119- t . Fatalf ("Failed to ping Redis: %v" , err )
127+ ef ("Failed to ping Redis: %v" , err )
120128 }
121129
122130 p ("Client connected successfully, starting push notification test" )
@@ -143,7 +151,7 @@ func TestPushNotifications(t *testing.T) {
143151 },
144152 })
145153 if err != nil {
146- t . Fatalf ("Failed to trigger failover action: %v" , err )
154+ ef ("Failed to trigger failover action: %v" , err )
147155 }
148156 go func () {
149157 p ("Waiting for FAILING_OVER notification" )
@@ -154,7 +162,7 @@ func TestPushNotifications(t *testing.T) {
154162 }()
155163 commandsRunner .FireCommandsUntilStop (ctx )
156164 if ! found {
157- t . Fatal ("FAILING_OVER notification was not received within 2 minutes" )
165+ ef ("FAILING_OVER notification was not received within 2 minutes" )
158166 }
159167 failingOverData := logs2 .ExtractDataFromLogMessage (match )
160168 p ("FAILING_OVER notification received. %v" , failingOverData )
@@ -169,7 +177,7 @@ func TestPushNotifications(t *testing.T) {
169177 }()
170178 commandsRunner .FireCommandsUntilStop (ctx )
171179 if ! found {
172- t . Fatal ("FAILED_OVER notification was not received within 2 minutes" )
180+ ef ("FAILED_OVER notification was not received within 2 minutes" )
173181 }
174182 failedOverData := logs2 .ExtractDataFromLogMessage (match )
175183 p ("FAILED_OVER notification received. %v" , failedOverData )
@@ -179,7 +187,7 @@ func TestPushNotifications(t *testing.T) {
179187 WithPollInterval (1 * time .Second ),
180188 )
181189 if err != nil {
182- t . Fatalf ("[FI] Failover action failed: %v" , err )
190+ ef ("[FI] Failover action failed: %v" , err )
183191 }
184192 fmt .Printf ("[FI] Failover action completed: %s\n " , status .Status )
185193
@@ -194,7 +202,7 @@ func TestPushNotifications(t *testing.T) {
194202 },
195203 })
196204 if err != nil {
197- t . Fatalf ("Failed to trigger migrate action: %v" , err )
205+ ef ("Failed to trigger migrate action: %v" , err )
198206 }
199207 go func () {
200208 match , found = logCollector .WaitForLogMatchFunc (func (s string ) bool {
@@ -204,7 +212,7 @@ func TestPushNotifications(t *testing.T) {
204212 }()
205213 commandsRunner .FireCommandsUntilStop (ctx )
206214 if ! found {
207- t . Fatal ("MIGRATING notification for migrate action was not received within 20 seconds" )
215+ ef ("MIGRATING notification for migrate action was not received within 20 seconds" )
208216 }
209217 migrateData := logs2 .ExtractDataFromLogMessage (match )
210218 seqIDToObserve = int64 (migrateData ["seqID" ].(float64 ))
@@ -216,7 +224,7 @@ func TestPushNotifications(t *testing.T) {
216224 WithPollInterval (1 * time .Second ),
217225 )
218226 if err != nil {
219- t . Fatalf ("[FI] Migrate action failed: %v" , err )
227+ ef ("[FI] Migrate action failed: %v" , err )
220228 }
221229 fmt .Printf ("[FI] Migrate action completed: %s\n " , status .Status )
222230
@@ -229,7 +237,7 @@ func TestPushNotifications(t *testing.T) {
229237 }()
230238 commandsRunner .FireCommandsUntilStop (ctx )
231239 if ! found {
232- t . Fatal ("MIGRATED notification was not received within 2 minutes" )
240+ ef ("MIGRATED notification was not received within 2 minutes" )
233241 }
234242 migratedData := logs2 .ExtractDataFromLogMessage (match )
235243 p ("MIGRATED notification received. %v" , migratedData )
@@ -247,7 +255,7 @@ func TestPushNotifications(t *testing.T) {
247255 },
248256 })
249257 if err != nil {
250- t . Fatalf ("Failed to trigger bind action: %v" , err )
258+ ef ("Failed to trigger bind action: %v" , err )
251259 }
252260
253261 // start a second client but don't execute any commands on it
@@ -269,7 +277,7 @@ func TestPushNotifications(t *testing.T) {
269277 })
270278
271279 if err != nil {
272- t . Fatalf ("failed to create client: %v" , err )
280+ ef ("failed to create client: %v" , err )
273281 }
274282 // setup tracking for second client
275283 tracker2 := NewTrackingNotificationsHook ()
@@ -336,15 +344,15 @@ func TestPushNotifications(t *testing.T) {
336344
337345 // Wait for the goroutine to complete and check for errors
338346 if err := <- errChan ; err != nil {
339- t . Fatalf ("Second client goroutine error: %v" , err )
347+ ef ("Second client goroutine error: %v" , err )
340348 }
341349
342350 // Wait for bind action to complete
343351 bindStatus , err := faultInjector .WaitForAction (ctx , bindResp .ActionID ,
344352 WithMaxWaitTime (120 * time .Second ),
345353 WithPollInterval (2 * time .Second ))
346354 if err != nil {
347- t . Fatalf ("Bind action failed: %v" , err )
355+ ef ("Bind action failed: %v" , err )
348356 }
349357
350358 p ("Bind action completed: %s" , bindStatus .Status )
@@ -457,7 +465,7 @@ func TestPushNotifications(t *testing.T) {
457465 trackerAnalysis .Print (t )
458466 logCollector .Clear ()
459467 tracker .Clear ()
460- t . Fatalf ("[FAIL] Errors detected in push notification test" )
468+ ef ("[FAIL] Errors detected in push notification test" )
461469 }
462470
463471 p ("Analysis complete, no errors found" )
0 commit comments