Skip to content

Commit c049dcd

Browse files
committed
Make TestSubscriptionResumptionCapacityStep2 an async test
Eliminate use of ZCLSubscribeAttribute and embrace asyncio.
1 parent 6e5d33e commit c049dcd

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/controller/python/test/test_scripts/base.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,7 @@ async def TestSubscriptionResumptionCapacityStep1(self, nodeid: int, endpoint: i
14541454

14551455
return True
14561456

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

14751476
if restartRemoteThread.is_alive():
14761477
# Thread join timed out

src/controller/python/test/test_scripts/subscription_resumption_capacity_test_ctrl2.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
# Commissioning test.
2121

22+
import asyncio
2223
import os
2324
import sys
2425
from optparse import OptionParser
@@ -125,8 +126,9 @@ def main():
125126
"Failed on on-network commissioing")
126127

127128
FailIfNot(
128-
test.TestSubscriptionResumptionCapacityStep2(options.nodeid, TEST_ENDPOINT_ID, options.deviceAddress,
129-
TEST_SSH_PORT, options.remoteServerApp, options.subscriptionCapacity),
129+
asyncio.run(
130+
test.TestSubscriptionResumptionCapacityStep2(options.nodeid, TEST_ENDPOINT_ID, options.deviceAddress,
131+
TEST_SSH_PORT, options.remoteServerApp, options.subscriptionCapacity)),
130132
"Failed on testing subscription resumption capacity")
131133

132134
timeoutTicker.stop()

0 commit comments

Comments
 (0)