Skip to content

Commit fea4554

Browse files
Adapt the unit-test to reflect fix in the previous commit
1 parent f92143e commit fea4554

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
@@ -352,37 +352,32 @@ BOOST_AUTO_TEST_CASE(notify_multiple_state_changes_outside_timeperiod)
352352
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
353353
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
354354
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
355-
// NOTE: This is the bug. The timer run above has reset the suppressed ServiceOK event
356-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
355+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationRecovery);
357356

358357
// Third Critical check result will set the Critical hard state.
359358
ReceiveCheckResults(2, ServiceCritical);
360359
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
361360
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
362361
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
363-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationProblem);
362+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
364363

365364
NotificationTimerHandler();
366365
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
367366
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
368367
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
369-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationProblem);
368+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
370369

371370
ReceiveCheckResults(1, ServiceOK);
372371
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
373372
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
374373
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
375-
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
374+
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), NotificationRecovery);
376375

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

380-
// No notification will be received because the suppressed notifications got borked
381-
// when they were cleared previously in FireSuppressedNotifications()
382378
NotificationTimerHandler();
383-
BOOST_REQUIRE(AssertNoAttemptedSendLogPattern());
384-
BOOST_REQUIRE_EQUAL(GetNotificationCount(), 1);
385-
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationProblem);
379+
BOOST_REQUIRE(WaitForExpectedNotificationCount(2));
380+
BOOST_REQUIRE_EQUAL(GetLastNotification(), NotificationRecovery);
386381
BOOST_REQUIRE_EQUAL(GetSuppressedNotifications(), 0);
387382
}
388383

0 commit comments

Comments
 (0)