update case
This commit is contained in:
parent
9cb3f9b3af
commit
f1e28fb865
|
@ -221,7 +221,7 @@ class TDTestCase:
|
||||||
tdLog.debug(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname))
|
tdLog.debug(" ==== check insert tbnames first failed , this is {}_th retry check tbnames of database {}".format(count , dbname))
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
def _get_stop_dnode_id(self , dbname , role):
|
def _get_stop_dnode_id(self , dbname , dnode_role):
|
||||||
|
|
||||||
tdSql.query("show {}.vgroups".format(dbname))
|
tdSql.query("show {}.vgroups".format(dbname))
|
||||||
vgroup_infos = tdSql.queryResult
|
vgroup_infos = tdSql.queryResult
|
||||||
|
@ -229,7 +229,7 @@ class TDTestCase:
|
||||||
leader_infos = vgroup_info[3:-4]
|
leader_infos = vgroup_info[3:-4]
|
||||||
# print(vgroup_info)
|
# print(vgroup_info)
|
||||||
for ind ,role in enumerate(leader_infos):
|
for ind ,role in enumerate(leader_infos):
|
||||||
if role == role:
|
if dnode_role == role:
|
||||||
# print(ind,leader_infos)
|
# print(ind,leader_infos)
|
||||||
self.stop_dnode_id = leader_infos[ind-1]
|
self.stop_dnode_id = leader_infos[ind-1]
|
||||||
break
|
break
|
||||||
|
@ -237,10 +237,10 @@ class TDTestCase:
|
||||||
|
|
||||||
return self.stop_dnode_id
|
return self.stop_dnode_id
|
||||||
|
|
||||||
def wait_stop_dnode_OK(self):
|
def wait_stop_dnode_OK(self ,newTdSql):
|
||||||
|
|
||||||
def _get_status():
|
def _get_status():
|
||||||
newTdSql=tdCom.newTdSql()
|
# newTdSql=tdCom.newTdSql()
|
||||||
|
|
||||||
status = ""
|
status = ""
|
||||||
newTdSql.query("show dnodes")
|
newTdSql.query("show dnodes")
|
||||||
|
@ -260,10 +260,10 @@ class TDTestCase:
|
||||||
# tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode))
|
# tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode))
|
||||||
tdLog.notice("==== stop_dnode has stopped , id is {} ====".format(self.stop_dnode_id))
|
tdLog.notice("==== stop_dnode has stopped , id is {} ====".format(self.stop_dnode_id))
|
||||||
|
|
||||||
def wait_start_dnode_OK(self):
|
def wait_start_dnode_OK(self ,newTdSql):
|
||||||
|
|
||||||
def _get_status():
|
def _get_status():
|
||||||
newTdSql=tdCom.newTdSql()
|
# newTdSql=tdCom.newTdSql()
|
||||||
status = ""
|
status = ""
|
||||||
newTdSql.query("show dnodes")
|
newTdSql.query("show dnodes")
|
||||||
dnode_infos = newTdSql.queryResult
|
dnode_infos = newTdSql.queryResult
|
||||||
|
@ -371,12 +371,13 @@ class TDTestCase:
|
||||||
def sync_run_case(self):
|
def sync_run_case(self):
|
||||||
# stop follower and insert datas , update tables and create new stables
|
# stop follower and insert datas , update tables and create new stables
|
||||||
tdDnodes=cluster.dnodes
|
tdDnodes=cluster.dnodes
|
||||||
|
newTdSql = tdCom.newTdSql()
|
||||||
for loop in range(self.loop_restart_times):
|
for loop in range(self.loop_restart_times):
|
||||||
db_name = "sync_db_{}".format(loop)
|
db_name = "sync_db_{}".format(loop)
|
||||||
stablename = 'stable_{}'.format(loop)
|
stablename = 'stable_{}'.format(loop)
|
||||||
self.create_database(dbname = db_name ,replica_num= self.replica , vgroup_nums= 1)
|
self.create_database(dbname = db_name ,replica_num= self.replica , vgroup_nums= 1)
|
||||||
self.create_stable_insert_datas(dbname = db_name , stablename = stablename , tb_nums= 10 ,row_nums= 10 )
|
self.create_stable_insert_datas(dbname = db_name , stablename = stablename , tb_nums= 10 ,row_nums= 10 )
|
||||||
self.stop_dnode_id = self._get_stop_dnode_id(db_name)
|
self.stop_dnode_id = self._get_stop_dnode_id(db_name , "follower")
|
||||||
|
|
||||||
# check rows of datas
|
# check rows of datas
|
||||||
|
|
||||||
|
@ -386,7 +387,7 @@ class TDTestCase:
|
||||||
start = time.time()
|
start = time.time()
|
||||||
tdDnodes[self.stop_dnode_id-1].stoptaosd()
|
tdDnodes[self.stop_dnode_id-1].stoptaosd()
|
||||||
|
|
||||||
self.wait_stop_dnode_OK()
|
self.wait_stop_dnode_OK(newTdSql)
|
||||||
|
|
||||||
# append rows of stablename when dnode stop
|
# append rows of stablename when dnode stop
|
||||||
|
|
||||||
|
@ -404,7 +405,7 @@ class TDTestCase:
|
||||||
|
|
||||||
# begin start dnode
|
# begin start dnode
|
||||||
tdDnodes[self.stop_dnode_id-1].starttaosd()
|
tdDnodes[self.stop_dnode_id-1].starttaosd()
|
||||||
self.wait_start_dnode_OK()
|
self.wait_start_dnode_OK(newTdSql)
|
||||||
end = time.time()
|
end = time.time()
|
||||||
time_cost = int(end -start)
|
time_cost = int(end -start)
|
||||||
if time_cost > self.max_restart_time:
|
if time_cost > self.max_restart_time:
|
||||||
|
@ -421,7 +422,7 @@ class TDTestCase:
|
||||||
def _restart_dnode_of_db_unsync(dbname):
|
def _restart_dnode_of_db_unsync(dbname):
|
||||||
start = time.time()
|
start = time.time()
|
||||||
tdDnodes=cluster.dnodes
|
tdDnodes=cluster.dnodes
|
||||||
self.stop_dnode_id = self._get_stop_dnode_id(dbname)
|
self.stop_dnode_id = self._get_stop_dnode_id(dbname ,"follower")
|
||||||
# begin restart dnode
|
# begin restart dnode
|
||||||
tdDnodes[self.stop_dnode_id-1].stoptaosd()
|
tdDnodes[self.stop_dnode_id-1].stoptaosd()
|
||||||
self.wait_stop_dnode_OK()
|
self.wait_stop_dnode_OK()
|
||||||
|
|
|
@ -236,10 +236,10 @@ class TDTestCase:
|
||||||
|
|
||||||
return self.stop_dnode_id
|
return self.stop_dnode_id
|
||||||
|
|
||||||
def wait_stop_dnode_OK(self):
|
def wait_stop_dnode_OK(self ,newTdSql):
|
||||||
|
|
||||||
def _get_status():
|
def _get_status():
|
||||||
newTdSql=tdCom.newTdSql()
|
# newTdSql=tdCom.newTdSql()
|
||||||
|
|
||||||
status = ""
|
status = ""
|
||||||
newTdSql.query("show dnodes")
|
newTdSql.query("show dnodes")
|
||||||
|
@ -259,10 +259,10 @@ class TDTestCase:
|
||||||
# tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode))
|
# tdLog.notice("==== stop dnode has not been stopped , endpoint is {}".format(self.stop_dnode))
|
||||||
tdLog.notice("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id))
|
tdLog.notice("==== stop_dnode has stopped , id is {}".format(self.stop_dnode_id))
|
||||||
|
|
||||||
def wait_start_dnode_OK(self):
|
def wait_start_dnode_OK(self ,newTdSql):
|
||||||
|
|
||||||
def _get_status():
|
def _get_status():
|
||||||
newTdSql=tdCom.newTdSql()
|
# newTdSql=tdCom.newTdSql()
|
||||||
status = ""
|
status = ""
|
||||||
newTdSql.query("show dnodes")
|
newTdSql.query("show dnodes")
|
||||||
dnode_infos = newTdSql.queryResult
|
dnode_infos = newTdSql.queryResult
|
||||||
|
@ -370,6 +370,7 @@ class TDTestCase:
|
||||||
def sync_run_case(self):
|
def sync_run_case(self):
|
||||||
# stop follower and insert datas , update tables and create new stables
|
# stop follower and insert datas , update tables and create new stables
|
||||||
tdDnodes=cluster.dnodes
|
tdDnodes=cluster.dnodes
|
||||||
|
newTdSql=tdCom.newTdSql()
|
||||||
for loop in range(self.loop_restart_times):
|
for loop in range(self.loop_restart_times):
|
||||||
db_name = "sync_db_{}".format(loop)
|
db_name = "sync_db_{}".format(loop)
|
||||||
stablename = 'stable_{}'.format(loop)
|
stablename = 'stable_{}'.format(loop)
|
||||||
|
@ -385,7 +386,7 @@ class TDTestCase:
|
||||||
start = time.time()
|
start = time.time()
|
||||||
tdDnodes[self.stop_dnode_id-1].stoptaosd()
|
tdDnodes[self.stop_dnode_id-1].stoptaosd()
|
||||||
|
|
||||||
self.wait_stop_dnode_OK()
|
self.wait_stop_dnode_OK(newTdSql)
|
||||||
|
|
||||||
# append rows of stablename when dnode stop
|
# append rows of stablename when dnode stop
|
||||||
|
|
||||||
|
@ -403,7 +404,7 @@ class TDTestCase:
|
||||||
|
|
||||||
# begin start dnode
|
# begin start dnode
|
||||||
tdDnodes[self.stop_dnode_id-1].starttaosd()
|
tdDnodes[self.stop_dnode_id-1].starttaosd()
|
||||||
self.wait_start_dnode_OK()
|
self.wait_start_dnode_OK(newTdSql)
|
||||||
end = time.time()
|
end = time.time()
|
||||||
time_cost = int(end -start)
|
time_cost = int(end -start)
|
||||||
if time_cost > self.max_restart_time:
|
if time_cost > self.max_restart_time:
|
||||||
|
@ -418,14 +419,15 @@ class TDTestCase:
|
||||||
def unsync_run_case(self):
|
def unsync_run_case(self):
|
||||||
|
|
||||||
def _restart_dnode_of_db_unsync(dbname):
|
def _restart_dnode_of_db_unsync(dbname):
|
||||||
|
newTdSql=tdCom.newTdSql()
|
||||||
start = time.time()
|
start = time.time()
|
||||||
tdDnodes=cluster.dnodes
|
tdDnodes=cluster.dnodes
|
||||||
self.stop_dnode_id = self._get_stop_dnode_id(dbname)
|
self.stop_dnode_id = self._get_stop_dnode_id(dbname)
|
||||||
# begin restart dnode
|
# begin restart dnode
|
||||||
tdDnodes[self.stop_dnode_id-1].stoptaosd()
|
tdDnodes[self.stop_dnode_id-1].stoptaosd()
|
||||||
self.wait_stop_dnode_OK()
|
self.wait_stop_dnode_OK(newTdSql)
|
||||||
tdDnodes[self.stop_dnode_id-1].starttaosd()
|
tdDnodes[self.stop_dnode_id-1].starttaosd()
|
||||||
self.wait_start_dnode_OK()
|
self.wait_start_dnode_OK(newTdSql)
|
||||||
end = time.time()
|
end = time.time()
|
||||||
time_cost = int(end-start)
|
time_cost = int(end-start)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue