test(stream): add status check before pause/resume streams.

This commit is contained in:
Haojun Liao 2025-03-13 14:55:22 +08:00
parent 651c2e57b4
commit 83cc432bf9
1 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,7 @@
# expressly provided by the written permission from Jianhui Tao # expressly provided by the written permission from Jianhui Tao
# #
################################################################### ###################################################################
import time
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
@ -88,6 +89,17 @@ class TDTestCase:
return True return True
def restart_stream(self): def restart_stream(self):
st = time.time()
while True:
sql = 'select status from information_schema.ins_stream_tasks where status<>"ready" '
if len(tdSql.getResult(sql)) != 0:
time.sleep(1)
tdLog.info("wait for task to be ready, 1s")
else:
et = time.time()
tdLog.info(f"wait for tasks to be ready: {et-st}s")
break
tdLog.debug("========restart stream========") tdLog.debug("========restart stream========")
for i in range(5): for i in range(5):
tdSql.execute("pause stream s1") tdSql.execute("pause stream s1")