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

Edge case defect when importing the first test node into dashboard #763

Merged
Merged
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
7 changes: 6 additions & 1 deletion matter_server/server/device_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,12 @@ async def import_test_node(self, dump: str) -> None:
else:
dump_nodes = dump_data["data"]["server"]["nodes"]
# node ids > 900000 are reserved for test nodes
next_test_node_id = max(*(x for x in self._nodes), TEST_NODE_START) + 1
if self._nodes:
next_test_node_id = max(*(x for x in self._nodes), TEST_NODE_START) + 1
else:
# an empty self._nodes dict evaluates to false so we set the first
# test node id to TEST_NODE_START
next_test_node_id = TEST_NODE_START
for node_dict in dump_nodes:
node = dataclass_from_dict(MatterNodeData, node_dict, strict=True)
node.node_id = next_test_node_id
Expand Down
Loading