Skip to content

Commit

Permalink
[matter_yamltests] Update try_update_yaml_node_id_test_runner_state t…
Browse files Browse the repository at this point in the history
…o take into account WaitForCommissionee and cases where the node id should not be updated
  • Loading branch information
vivien-apple committed Jan 26, 2023
1 parent 09ea936 commit aa341b7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions scripts/py_matter_yamltests/matter_yamltests/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,31 @@ def try_add_yaml_support_for_scientific_notation_without_dot(loader):
# accessory. But this state may not exist in the runner (as in it prevent to have multiple node ids
# associated to a fabric...) so the 'nodeId' needs to be added back manually.
def try_update_yaml_node_id_test_runner_state(tests, config):
default_identity = 'alpha'
identities = {
'alpha': None if 'nodeId' not in config else config['nodeId']}
default_identity: None if 'nodeId' not in config else config['nodeId']}

for test in tests:
if not test.is_enabled:
continue

identity = test.identity

if test.cluster == 'CommissionerCommands':
if test.command == 'PairWithCode':
if test.cluster == 'CommissionerCommands' or test.cluster == 'DelayCommands':
if test.command == 'PairWithCode' or test.command == 'WaitForCommissionee':
if test.response_with_placeholders:
# It the test expects an error, we should not update the
# nodeId of the identity.
error = test.response_with_placeholders.get('error')
if error:
continue

for item in test.arguments_with_placeholders['values']:
if item['name'] == 'nodeId':
identities[identity] = item['value']
elif identity is not None and identity in identities:
node_id = identities[identity]
test.node_id = node_id
elif identity is None and default_identity in identities:
node_id = identities[default_identity]
test.node_id = node_id

0 comments on commit aa341b7

Please sign in to comment.