@@ -436,45 +436,47 @@ 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
442446 if trackerAnalysis .TotalNotifications > allLogsAnalysis .TotalNotifications {
443- e ("Expected %d or more notifications, got %d" , trackerAnalysis .TotalNotifications , allLogsAnalysis .TotalNotifications )
447+ e ("Expected at least %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
448450 if trackerAnalysis .MovingCount > allLogsAnalysis .MovingCount {
449- e ("Expected %d or more MOVING notifications, got %d" , trackerAnalysis .MovingCount , allLogsAnalysis .MovingCount )
451+ e ("Expected at least %d or more MOVING notifications, got %d" , trackerAnalysis .MovingCount , allLogsAnalysis .MovingCount )
450452 }
451453
452- if trackerAnalysis .MigratingCount != allLogsAnalysis .MigratingCount {
453- e ("Expected %d MIGRATING notifications, got %d" , trackerAnalysis .MigratingCount , allLogsAnalysis .MigratingCount )
454+ if trackerAnalysis .MigratingCount > allLogsAnalysis .MigratingCount {
455+ e ("Expected at least %d MIGRATING notifications, got %d" , trackerAnalysis .MigratingCount , allLogsAnalysis .MigratingCount )
454456 }
455457
456- if trackerAnalysis .MigratedCount != allLogsAnalysis .MigratedCount {
457- e ("Expected %d MIGRATED notifications, got %d" , trackerAnalysis .MigratedCount , allLogsAnalysis .MigratedCount )
458+ if trackerAnalysis .MigratedCount > allLogsAnalysis .MigratedCount {
459+ e ("Expected at least %d MIGRATED notifications, got %d" , trackerAnalysis .MigratedCount , allLogsAnalysis .MigratedCount )
458460 }
459461
460- if trackerAnalysis .FailingOverCount != allLogsAnalysis .FailingOverCount {
461- e ("Expected %d FAILING_OVER notifications, got %d" , trackerAnalysis .FailingOverCount , allLogsAnalysis .FailingOverCount )
462+ if trackerAnalysis .FailingOverCount > allLogsAnalysis .FailingOverCount {
463+ e ("Expected at least %d FAILING_OVER notifications, got %d" , trackerAnalysis .FailingOverCount , allLogsAnalysis .FailingOverCount )
462464 }
463465
464- if trackerAnalysis .FailedOverCount != allLogsAnalysis .FailedOverCount {
465- e ("Expected %d FAILED_OVER notifications, got %d" , trackerAnalysis .FailedOverCount , allLogsAnalysis .FailedOverCount )
466+ if trackerAnalysis .FailedOverCount > allLogsAnalysis .FailedOverCount {
467+ e ("Expected at least %d FAILED_OVER notifications, got %d" , trackerAnalysis .FailedOverCount , allLogsAnalysis .FailedOverCount )
466468 }
467469
468470 if trackerAnalysis .UnexpectedNotificationCount != allLogsAnalysis .UnexpectedCount {
469471 e ("Expected %d unexpected notifications, got %d" , trackerAnalysis .UnexpectedNotificationCount , allLogsAnalysis .UnexpectedCount )
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 - allLogsAnalysis . RelaxedPostHandoffCount )
478480 }
479481
480482 // validate all handoffs succeeded
0 commit comments