Skip to content

Commit 1fd58ee

Browse files
Adapt the unit-test to reflect fix in the previous commit
1 parent d079805 commit 1fd58ee

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
@@ -303,33 +303,28 @@ BOOST_AUTO_TEST_CASE(notify_after_multiple_state_changes_outside_timeperiod)
303303
NotificationTimerHandler();
304304
REQUIRE_FALSE_WITHIN(GetNotificationCount() > 1, 15ms);
305305
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
306-
// NOTE: This is the bug. The timer run above has reset the suppressed ServiceOK event
307-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
306+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationRecovery);
308307

309308
// Third Critical check result will set the Critical hard state.
310309
ReceiveCheckResults(2, ServiceCritical);
311310
REQUIRE_FALSE_WITHIN(GetNotificationCount() > 1, 15ms);
312311
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
313-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationProblem);
312+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
314313

315314
NotificationTimerHandler();
316315
REQUIRE_FALSE_WITHIN(GetNotificationCount() > 1, 15ms);
317316
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
318-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationProblem);
317+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
319318

320319
ReceiveCheckResults(1, ServiceOK);
321320
REQUIRE_FALSE_WITHIN(GetNotificationCount() > 1, 15ms);
322321
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
323-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
322+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationRecovery);
324323

325-
// Resonably we would now expect a NotificationRecovered, but it will not arrive due to the bug.
326324
BeginTimePeriod();
327-
328-
// No notification will be received because the suppressed notifications got borked
329-
// when they were cleared previously in FireSuppressedNotifications()
330325
NotificationTimerHandler();
331-
REQUIRE_FALSE_WITHIN(GetNotificationCount() > 1, 15ms);
332-
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
326+
REQUIRE_TRUE_WITHIN(GetNotificationCount() == 2, 15ms);
327+
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationRecovery);
333328
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
334329
}
335330

0 commit comments

Comments
 (0)