Add IM read event e2e test and fix the found bug (#8338)
Summary of Changes:
-- When generating report, we read event from debug priority to critical
priority, we should read event from cirtical priority to debug priority.
We add test to check the initial read events are from critical priority
via providing critical and info event. Without this fix, the test would
fail.
-- During test, we see current report engine fail to handle event-only
read request where it inserts empty attribute list, we rollback the
empty eventlist if no attribute is there, without this fix, the test
would fail
-- Fix event number calculation and event number test.
diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp
index 3bf47dd..40b207b 100644
--- a/src/app/EventManagement.cpp
+++ b/src/app/EventManagement.cpp
@@ -690,13 +690,14 @@
loadOutContext->mPreviousSystemTime.mValue = loadOutContext->mCurrentSystemTime.mValue;
loadOutContext->mFirst = false;
+ loadOutContext->mEventCount++;
}
return err;
}
CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, ClusterInfo * apClusterInfolist, PriorityLevel aPriority,
- EventNumber & aEventNumber)
+ EventNumber & aEventNumber, size_t & aEventCount)
{
// TODO: Add particular set of event Paths in FetchEventsSince so that we can filter the interested paths
CHIP_ERROR err = CHIP_NO_ERROR;
@@ -729,7 +730,7 @@
exit:
aEventNumber = context.mCurrentEventNumber;
-
+ aEventCount += context.mEventCount;
return err;
}