Skip to content

Commit a6ba476

Browse files
Adapt the unit-test to reflect fix in the previous commit
1 parent ee1fb14 commit a6ba476

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
@@ -291,33 +291,28 @@ BOOST_AUTO_TEST_CASE(notify_after_multiple_state_changes_outside_timeperiod)
291291
NotificationTimerHandler();
292292
REQUIRE_FALSE_WITHIN(GetNotificationCount() > 1, 10ms);
293293
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
294-
// NOTE: This is the bug. The timer run above has reset the suppressed ServiceOK event
295-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
294+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationRecovery);
296295

297296
// Third Critical check result will set the Critical hard state.
298297
ReceiveCheckResults(2, ServiceCritical);
299298
REQUIRE_FALSE_WITHIN(GetNotificationCount() > 1, 10ms);
300299
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
301-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationProblem);
300+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
302301

303302
NotificationTimerHandler();
304303
REQUIRE_FALSE_WITHIN(GetNotificationCount() > 1, 10ms);
305304
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
306-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationProblem);
305+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
307306

308307
ReceiveCheckResults(1, ServiceOK);
309308
REQUIRE_FALSE_WITHIN(GetNotificationCount() > 1, 10ms);
310309
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
311-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
310+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationRecovery);
312311

313-
// Resonably we would now expect a NotificationRecovered, but it will not arrive due to the bug.
314312
BeginTimePeriod();
315-
316-
// No notification will be received because the suppressed notifications got borked
317-
// when they were cleared previously in FireSuppressedNotifications()
318313
NotificationTimerHandler();
319-
REQUIRE_FALSE_WITHIN(GetNotificationCount() > 1, 10ms);
320-
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
314+
REQUIRE_TRUE_WITHIN(GetNotificationCount() == 2, 10ms);
315+
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationRecovery);
321316
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
322317
}
323318

0 commit comments

Comments
 (0)