Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

follow-up for fabric-scoped event #22014

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/EventLogging.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CHIP_ERROR LogEvent(const T & aEventData, EndpointId aEndpoint, EventNumber & aE
eventOptions.mPriority = aEventData.GetPriorityLevel();
eventOptions.mFabricIndex = aEventData.GetFabricIndex();
// this skips logging the event if it's fabric-scoped but no fabric association exists yet.
VerifyOrReturnError(eventOptions.mFabricIndex != kUndefinedFabricIndex, CHIP_NO_ERROR);
VerifyOrReturnError(eventOptions.mFabricIndex != kUndefinedFabricIndex, CHIP_ERROR_INVALID_FABRIC_INDEX);

//
// Unlike attributes which have a different 'EncodeForRead' for fabric-scoped structs,
Expand Down
14 changes: 10 additions & 4 deletions src/controller/python/test/test_scripts/cluster_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ async def _TriggerEvent(cls, devCtrl):
await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=Clusters.TestCluster.Commands.TestEmitTestEventRequest())
await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=Clusters.TestCluster.Commands.TestEmitTestEventRequest())
await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=Clusters.TestCluster.Commands.TestEmitTestEventRequest())
await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=Clusters.TestCluster.Commands.TestEmitTestFabricScopedEventRequest(arg1=0))
await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=Clusters.TestCluster.Commands.TestEmitTestFabricScopedEventRequest(arg1=1))

@classmethod
async def _RetryForContent(cls, request, until, retryCount=10, intervalSeconds=1):
Expand All @@ -335,11 +333,19 @@ async def TriggerAndWaitForEvents(cls, devCtrl, req):
@base.test_case
async def TestGenerateUndefinedFabricScopedEventRequests(cls, devCtrl):
logger.info("Running TestGenerateUndefinedFabricScopedEventRequests")
await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=Clusters.TestCluster.Commands.TestEmitTestFabricScopedEventRequest(arg1=0))
try:
res = await devCtrl.SendCommand(nodeid=NODE_ID, endpoint=1, payload=Clusters.TestCluster.Commands.TestEmitTestFabricScopedEventRequest(arg1=0))
raise ValueError(f"Unexpected Failure")
except chip.interaction_model.InteractionModelError as ex:
logger.info(f"Recevied {ex} from server.")
res = await devCtrl.ReadEvent(nodeid=NODE_ID, events=[
(1, Clusters.TestCluster.Events.TestEvent, 0),
(1, Clusters.TestCluster.Events.TestFabricScopedEvent, 0),
])
logger.info(f"return result is {res}")
if len(res) != 0:
raise AssertionError("failure: not expect to receive fabric-scoped event when fabric is undefined")
else:
logger.info("TestGenerateUndefinedFabricScopedEventRequests: Success")

@classmethod
@base.test_case
Expand Down