Skip to content

Commit 9ed6e2e

Browse files
committed
better second and third client checks
1 parent 1adb576 commit 9ed6e2e

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

maintnotifications/e2e/scenario_push_notifications_test.go

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@ func TestPushNotifications(t *testing.T) {
266266
errChan := make(chan error, 1)
267267

268268
go func() {
269-
var match string
270-
var matchNotif []interface{}
271-
var found bool
272269
defer func() {
273270
if r := recover(); r != nil {
274271
errChan <- fmt.Errorf("goroutine panic: %v", r)
@@ -280,6 +277,11 @@ func TestPushNotifications(t *testing.T) {
280277
return strings.Contains(s, logs2.ProcessingNotificationMessage) && notificationType(s, "MOVING")
281278
}, 3*time.Minute)
282279
commandsRunner.Stop()
280+
if !found {
281+
errChan <- fmt.Errorf("MOVING notification was not received within 3 minutes ON A FIRST CLIENT")
282+
return
283+
}
284+
283285
// once moving is received, start a second client commands runner
284286
p("Starting commands on second client")
285287
go commandsRunner2.FireCommandsUntilStop(ctx)
@@ -289,33 +291,26 @@ func TestPushNotifications(t *testing.T) {
289291
// destroy the second client
290292
factory.Destroy("push-notification-client-2")
291293
}()
292-
// wait for moving on second client
293-
// we know the maxconn is 15, assuming 16/17 was used to init the second client, so connID 18 should be from the second client
294-
// also validate big enough relaxed timeout
294+
295295
p("Waiting for MOVING notification on second client")
296-
matchNotif, found = tracker2.FindOrWaitForNotification("MOVING", 3*time.Minute)
297-
if !found {
296+
matchNotif, fnd := tracker2.FindOrWaitForNotification("MOVING", 3*time.Minute)
297+
if !fnd {
298298
errChan <- fmt.Errorf("MOVING notification was not received within 3 minutes ON A SECOND CLIENT")
299299
return
300300
} else {
301301
p("MOVING notification received on second client %v", matchNotif)
302302
}
303303

304-
// wait for relaxation of 30m
305-
match, found = logCollector.MatchOrWaitForLogMatchFunc(func(s string) bool {
306-
return strings.Contains(s, logs2.ApplyingRelaxedTimeoutDueToPostHandoffMessage) && strings.Contains(s, "30m")
307-
}, 3*time.Minute)
308-
if !found {
309-
errChan <- fmt.Errorf("relaxed timeout was not applied within 3 minutes ON A SECOND CLIENT")
310-
return
311-
} else {
312-
p("Relaxed timeout applied on second client")
313-
}
314304
// Signal success
315305
errChan <- nil
316306
}()
317307
commandsRunner.FireCommandsUntilStop(ctx)
318-
308+
// wait for moving on first client
309+
// once the commandRunner stops, it means a waiting
310+
// on the logCollector match has completed and we can proceed
311+
if !found {
312+
ef("MOVING notification was not received within 3 minutes")
313+
}
319314
movingData := logs2.ExtractDataFromLogMessage(match)
320315
p("MOVING notification received. %v", movingData)
321316
seqIDToObserve = int64(movingData["seqID"].(float64))

0 commit comments

Comments
 (0)