Skip to content

Commit 68199f2

Browse files
committed
fix test assertions
1 parent 5fa97c8 commit 68199f2

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

maintnotifications/e2e/scenario_push_notifications_test.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -436,32 +436,34 @@ func TestPushNotifications(t *testing.T) {
436436
e("No logs found for connection %d", connID)
437437
}
438438
}
439+
// checks are tracker >= logs since the tracker only tracks client1
440+
// logs include all clients (and some of them start logging even before all hooks are setup)
441+
// for example for idle connections if they receive a notification before the hook is setup
442+
// the action (i.e. relaxing timeouts) will be logged, but the notification will not be tracked and maybe wont be logged
439443

440444
// validate number of notifications in tracker matches number of notifications in logs
441445
// allow for more moving in the logs since we started a second client
442-
if trackerAnalysis.TotalNotifications > allLogsAnalysis.TotalNotifications {
446+
if trackerAnalysis.TotalNotifications >= allLogsAnalysis.TotalNotifications {
443447
e("Expected %d or more notifications, got %d", trackerAnalysis.TotalNotifications, allLogsAnalysis.TotalNotifications)
444448
}
445449

446-
// and per type
447-
// allow for more moving in the logs since we started a second client
448-
if trackerAnalysis.MovingCount > allLogsAnalysis.MovingCount {
450+
if trackerAnalysis.MovingCount >= allLogsAnalysis.MovingCount {
449451
e("Expected %d or more MOVING notifications, got %d", trackerAnalysis.MovingCount, allLogsAnalysis.MovingCount)
450452
}
451453

452-
if trackerAnalysis.MigratingCount != allLogsAnalysis.MigratingCount {
454+
if trackerAnalysis.MigratingCount >= allLogsAnalysis.MigratingCount {
453455
e("Expected %d MIGRATING notifications, got %d", trackerAnalysis.MigratingCount, allLogsAnalysis.MigratingCount)
454456
}
455457

456-
if trackerAnalysis.MigratedCount != allLogsAnalysis.MigratedCount {
458+
if trackerAnalysis.MigratedCount >= allLogsAnalysis.MigratedCount {
457459
e("Expected %d MIGRATED notifications, got %d", trackerAnalysis.MigratedCount, allLogsAnalysis.MigratedCount)
458460
}
459461

460-
if trackerAnalysis.FailingOverCount != allLogsAnalysis.FailingOverCount {
462+
if trackerAnalysis.FailingOverCount >= allLogsAnalysis.FailingOverCount {
461463
e("Expected %d FAILING_OVER notifications, got %d", trackerAnalysis.FailingOverCount, allLogsAnalysis.FailingOverCount)
462464
}
463465

464-
if trackerAnalysis.FailedOverCount != allLogsAnalysis.FailedOverCount {
466+
if trackerAnalysis.FailedOverCount >= allLogsAnalysis.FailedOverCount {
465467
e("Expected %d FAILED_OVER notifications, got %d", trackerAnalysis.FailedOverCount, allLogsAnalysis.FailedOverCount)
466468
}
467469

@@ -470,11 +472,11 @@ func TestPushNotifications(t *testing.T) {
470472
}
471473

472474
// unrelaxed (and relaxed) after moving wont be tracked by the hook, so we have to exclude it
473-
if trackerAnalysis.UnrelaxedTimeoutCount != allLogsAnalysis.UnrelaxedTimeoutCount-allLogsAnalysis.UnrelaxedAfterMoving {
474-
e("Expected %d unrelaxed timeouts, got %d", trackerAnalysis.UnrelaxedTimeoutCount, allLogsAnalysis.UnrelaxedTimeoutCount-allLogsAnalysis.UnrelaxedAfterMoving)
475+
if trackerAnalysis.UnrelaxedTimeoutCount >= allLogsAnalysis.UnrelaxedTimeoutCount-allLogsAnalysis.UnrelaxedAfterMoving {
476+
e("Expected at least %d unrelaxed timeouts, got %d", trackerAnalysis.UnrelaxedTimeoutCount, allLogsAnalysis.UnrelaxedTimeoutCount-allLogsAnalysis.UnrelaxedAfterMoving)
475477
}
476-
if trackerAnalysis.RelaxedTimeoutCount != allLogsAnalysis.RelaxedTimeoutCount-allLogsAnalysis.RelaxedPostHandoffCount {
477-
e("Expected %d relaxed timeouts, got %d", trackerAnalysis.RelaxedTimeoutCount, allLogsAnalysis.RelaxedTimeoutCount)
478+
if trackerAnalysis.RelaxedTimeoutCount >= allLogsAnalysis.RelaxedTimeoutCount-allLogsAnalysis.RelaxedPostHandoffCount {
479+
e("Expected at least%d relaxed timeouts, got %d", trackerAnalysis.RelaxedTimeoutCount, allLogsAnalysis.RelaxedTimeoutCount)
478480
}
479481

480482
// validate all handoffs succeeded

0 commit comments

Comments
 (0)