Skip to content

Commit 41b5383

Browse files
Adapt the unit-test to reflect fix in the previous commit
1 parent aef2986 commit 41b5383

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

test/notification-notificationcomponent.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -339,37 +339,32 @@ BOOST_AUTO_TEST_CASE(notify_multiple_state_changes_outside_timeperiod)
339339
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
340340
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
341341
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
342-
// NOTE: This is the bug. The timer run above has reset the suppressed ServiceOK event
343-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
342+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationRecovery);
344343

345344
// Third Critical check result will set the Critical hard state.
346345
ReceiveCheckResults(2, ServiceCritical);
347346
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
348347
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
349348
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
350-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationProblem);
349+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
351350

352351
NotificationTimerHandler();
353352
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
354353
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
355354
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
356-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationProblem);
355+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
357356

358357
ReceiveCheckResults(1, ServiceOK);
359358
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
360359
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
361360
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
362-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
361+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationRecovery);
363362

364-
// Resonably we would now expect a NotificationRecovered, but it will not arrive due to the bug.
365363
BeginTimePeriod();
366364

367-
// No notification will be received because the suppressed notifications got borked
368-
// when they were cleared previously in FireSuppressedNotifications()
369365
NotificationTimerHandler();
370-
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
371-
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
372-
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
366+
BOOST_REQUIRE(WaitForExpectedNotificationCount(2));
367+
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationRecovery);
373368
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
374369
}
375370

0 commit comments

Comments
 (0)