Skip to content

Commit c08038d

Browse files
Adapt the unit-test to reflect fix in the previous commit
1 parent ee2f43d commit c08038d

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
@@ -338,37 +338,32 @@ BOOST_AUTO_TEST_CASE(notify_multiple_state_changes_outside_timeperiod)
338338
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
339339
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
340340
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
341-
// NOTE: This is the bug. The timer run above has reset the suppressed ServiceOK event
342-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
341+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationRecovery);
343342

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

351350
NotificationTimerHandler();
352351
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
353352
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
354353
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
355-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationProblem);
354+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
356355

357356
ReceiveCheckResults(1, ServiceOK);
358357
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
359358
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
360359
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
361-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
360+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationRecovery);
362361

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

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

0 commit comments

Comments
 (0)