Skip to content

[Bug] Copying Admin Storage Prevents Retention of Message Counter State #1070

Description

@zaid-google

Describe the bug

This issue is a problem with regards to how the test harness manages its admin_storage.json file, and as a result its message counter data. The problem was found when running the tests mentioned below.

This was found when running TC-ACE-1.6 and TC-SC-5.2 on the same commissioning window (i.e. run one of them with commissioning, and then the other without a factory reset). This can also happen when either of these 2 tests are run 2 times in a row (again, with no factory reset).

The tests fails on the second run, because of unexpected values for the event checks. In step 20a and 16b of TC_ACE_1.6 and TC_SC_5.2 respectively, the test expects certain values for a groupcast testing event, but instead a message replay event is sent back. This happens because of how the test harness is handling admin_storage.json between test runs.

The following code is called on the first test run:
https://github.com/project-chip/certification-tool-backend/blob/main/test_collections/matter/sdk_tests/support/python_testing/models/utils.py#L202

And then this code is called on the second test run:
https://github.com/project-chip/certification-tool-backend/blob/main/test_collections/matter/sdk_tests/support/python_testing/models/utils.py#L303
Showing that it will copy a version of the admin_storage.json file to the container. The admin_storage.json file is snapshotted once after commissioning then copied to the container before every test where commissioning is not re-done. This file contains information on the state of the message counter to determine what the next valid message counter should be for an outgoing message. These message counters are supposed to be monotonically increasing, as when the counters are repeated the message is marked as a duplicate. Keys such as g/gdc and g/gcc which are required for these monotonically increasing message counters are reset backwards, which then causes message replays. At the end of the first test run, the updated values in admin_storage.json are not brought back before the second test run.

Before running either TC_ACE_1.6 or TC_SC_5.2, the DUT MUST be factory reset in order to avoid this problem. Otherwise, these tests may fail due to message duplication causing different event data than expected.

Steps to reproduce the behavior

No response

Expected behavior

No response

Log files

No response

PICS file

No response

Screenshots

No response

Environment

No response

Additional Information

No response

Metadata

Metadata

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions