Skip to content

Commit

Permalink
Make TestSubscriptionResumptionCapacityStep2 an async test
Browse files Browse the repository at this point in the history
Eliminate use of ZCLSubscribeAttribute and embrace asyncio.
  • Loading branch information
agners committed May 7, 2024
1 parent 6e5d33e commit c049dcd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/controller/python/test/test_scripts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1454,7 +1454,7 @@ async def TestSubscriptionResumptionCapacityStep1(self, nodeid: int, endpoint: i

return True

def TestSubscriptionResumptionCapacityStep2(self, nodeid: int, endpoint: int, remote_ip: str, ssh_port: int,
async def TestSubscriptionResumptionCapacityStep2(self, nodeid: int, endpoint: int, remote_ip: str, ssh_port: int,
remote_server_app: str, subscription_capacity: int):
try:
self.logger.info("Restart remote deivce")
Expand All @@ -1469,8 +1469,9 @@ def TestSubscriptionResumptionCapacityStep2(self, nodeid: int, endpoint: int, re
self.logger.info("Send a new subscription request from the second controller")
# Close previous session so that the second controller will res-establish the session with the remote device
self.devCtrl.CloseSession(nodeid)
self.devCtrl.ZCLSubscribeAttribute(
"BasicInformation", "NodeLabel", nodeid, endpoint, 1, 50, keepSubscriptions=True, autoResubscribe=False)
await self.devCtrl.ReadAttribute(nodeid, [(endpoint, Clusters.BasicInformation.Attributes.NodeLabel)], None,
False, reportInterval=(1, 50),
keepSubscriptions=True, autoResubscribe=False)

if restartRemoteThread.is_alive():
# Thread join timed out
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

# Commissioning test.

import asyncio
import os
import sys
from optparse import OptionParser
Expand Down Expand Up @@ -125,8 +126,9 @@ def main():
"Failed on on-network commissioing")

FailIfNot(
test.TestSubscriptionResumptionCapacityStep2(options.nodeid, TEST_ENDPOINT_ID, options.deviceAddress,
TEST_SSH_PORT, options.remoteServerApp, options.subscriptionCapacity),
asyncio.run(
test.TestSubscriptionResumptionCapacityStep2(options.nodeid, TEST_ENDPOINT_ID, options.deviceAddress,
TEST_SSH_PORT, options.remoteServerApp, options.subscriptionCapacity)),
"Failed on testing subscription resumption capacity")

timeoutTicker.stop()
Expand Down

0 comments on commit c049dcd

Please sign in to comment.