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

[matter_yamltests] Update try_update_yaml_node_id_test_runner_state t… #24656

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
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':
vivien-apple marked this conversation as resolved.
Show resolved Hide resolved
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
2 changes: 1 addition & 1 deletion src/controller/python/chip/yaml/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ class WaitForCommissioneeAction(BaseAction):

def __init__(self, test_step):
super().__init__(test_step)
self._node_id = test_step.node_id
self._expire_existing_session = False
# This is the default when no timeout is provided.
_DEFAULT_TIMEOUT_MS = 10 * 1000
Expand All @@ -254,6 +253,7 @@ def __init__(self, test_step):
args = test_step.arguments['values']
request_data_as_dict = Converter.convert_list_of_name_value_pair_to_dict(args)

self._node_id = request_data_as_dict['nodeId']
self._expire_existing_session = request_data_as_dict.get('expireExistingSession', False)
if 'timeout' in request_data_as_dict:
# Timeout is provided in seconds we need to conver to milliseconds.
Expand Down