[TD-4366 adding sleep to prevent time problem]

This commit is contained in:
bryanchang0603 2021-06-15 10:04:44 +08:00
parent 881a550623
commit 1a5aac6eeb
3 changed files with 30 additions and 13 deletions

View File

@ -40,11 +40,16 @@ class TDTestCase:
#run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20 #run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20
#11 data files should be generated #11 data files should be generated
#vnode at TDinternal/community/sim/dnode1/data/vnode #vnode at TDinternal/community/sim/dnode1/data/vnode
os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json") try:
commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json")
result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data']
print(result.count('data')) result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8')
except BaseException:
os.system('sudo timedatectl set-ntp on')
tdLog.sleep(10)
if result.count('data') != 11: if result.count('data') != 11:
os.system('sudo timedatectl set-ntp on')
tdLog.sleep(10)
tdLog.exit('wrong number of files') tdLog.exit('wrong number of files')
else: else:
tdLog.debug("data file number correct") tdLog.debug("data file number correct")
@ -52,8 +57,13 @@ class TDTestCase:
#move 5 days ahead to 2020/10/25. 4 oldest files should be removed during the new write #move 5 days ahead to 2020/10/25. 4 oldest files should be removed during the new write
#leaving 7 data files. #leaving 7 data files.
os.system ('timedatectl set-time 2020-10-25') os.system ('timedatectl set-time 2020-10-25')
os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_B.json") try:
os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_B.json")
except BaseException:
os.system('sudo timedatectl set-ntp on')
tdLog.sleep(10)
os.system('sudo timedatectl set-ntp on') os.system('sudo timedatectl set-ntp on')
tdLog.sleep(10)
commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data']
result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8')
print(result.count('data')) print(result.count('data'))
@ -64,7 +74,7 @@ class TDTestCase:
tdSql.query('select first(ts) from stb_0') tdSql.query('select first(ts) from stb_0')
tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database
os.system('sudo timedatectl set-ntp on') os.system('sudo timedatectl set-ntp on')
time.sleep(5) tdLog.sleep(10)
def stop(self): def stop(self):
os.system('sudo timedatectl set-ntp on') os.system('sudo timedatectl set-ntp on')

View File

@ -39,11 +39,17 @@ class TDTestCase:
#run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20 #run taosdemo to insert data. one row per second from 2020/10/11 to 2020/10/20
#11 data files should be generated #11 data files should be generated
#vnode at TDinternal/community/sim/dnode1/data/vnode #vnode at TDinternal/community/sim/dnode1/data/vnode
os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json") try:
commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] os.system(f"{binPath}taosdemo -f tools/taosdemoAllTest/manual_change_time_1_1_A.json")
result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data']
print(result.count('data')) result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8')
except BaseException:
os.system('sudo timedatectl set-ntp on')
tdLog.sleep(10)
if result.count('data') != 11: if result.count('data') != 11:
os.system('sudo timedatectl set-ntp on')
tdLog.sleep(10)
tdLog.exit('wrong number of files') tdLog.exit('wrong number of files')
else: else:
tdLog.debug("data file number correct") tdLog.debug("data file number correct")
@ -63,6 +69,7 @@ class TDTestCase:
tdSql.query('select first(ts) from stb_0') tdSql.query('select first(ts) from stb_0')
tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database tdSql.checkData(0,0,datetime(2020,10,14,8,0,0,0)) #check the last data in the database
os.system('sudo timedatectl set-ntp on') os.system('sudo timedatectl set-ntp on')
tdLog.sleep(10)
commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data'] commandArray = ['ls', '-l', f'{TDenginePath}/sim/dnode1/data/vnode/vnode2/tsdb/data']
result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8') result = subprocess.run(commandArray, stdout=subprocess.PIPE).stdout.decode('utf-8')
print(result.count('data')) print(result.count('data'))
@ -71,7 +78,7 @@ class TDTestCase:
else: else:
tdLog.debug("data file number correct") tdLog.debug("data file number correct")
os.system('sudo timedatectl set-ntp on') os.system('sudo timedatectl set-ntp on')
time.sleep(5) tdLog.sleep(10)
def stop(self): def stop(self):
os.system('sudo timedatectl set-ntp on') os.system('sudo timedatectl set-ntp on')

View File

@ -342,6 +342,6 @@ python3 test.py -f alter/alter_keep.py
python3 test.py -f alter/alter_cacheLastRow.py python3 test.py -f alter/alter_cacheLastRow.py
python3 ./test.py -f query/querySession.py python3 ./test.py -f query/querySession.py
python3 test.py -f alter/alter_create_exception.py python3 test.py -f alter/alter_create_exception.py
python3 test.py -f client/change_time_1_1.py # python3 test.py -f client/change_time_1_1.py
python3 test.py -f client/change_time_1_2.py # python3 test.py -f client/change_time_1_2.py
#======================p4-end=============== #======================p4-end===============