coverage: snapshot add stop taosd and start

This commit is contained in:
Alex Duan 2024-02-20 18:40:25 +08:00
parent 6cdef62f92
commit 87ad111b2c
2 changed files with 19 additions and 3 deletions

View File

@ -25,6 +25,7 @@ from frame.cases import *
from frame.sql import * from frame.sql import *
from frame.caseBase import * from frame.caseBase import *
from frame import * from frame import *
from frame.srvCtl import *
class TDTestCase(TBase): class TDTestCase(TBase):
@ -65,6 +66,21 @@ class TDTestCase(TBase):
sql = f"select avg(dc) from {self.db}.{self.stb}" sql = f"select avg(dc) from {self.db}.{self.stb}"
tdSql.checkFirstValue(sql, 200) tdSql.checkFirstValue(sql, 200)
def alterReplica3(self):
sql = f"alter database {self.db} replica 3"
tdSql.execute(sql, show=True)
time.sleep(2)
sc.dnodeStop(2)
sc.dnodeStop(3)
time.sleep(5)
sc.dnodeStart(2)
sc.dnodeStart(3)
if self.waitTransactionZero() is False:
tdLog.exit(f"{sql} transaction not finished")
return False
return True
def doAction(self): def doAction(self):
tdLog.info(f"do action.") tdLog.info(f"do action.")
self.flushDb() self.flushDb()
@ -81,7 +97,7 @@ class TDTestCase(TBase):
self.alterReplica(1) self.alterReplica(1)
self.checkAggCorrect() self.checkAggCorrect()
self.compactDb() self.compactDb()
self.alterReplica(3) self.alterReplica3()
vgids = self.getVGroup(self.db) vgids = self.getVGroup(self.db)
selid = random.choice(vgids) selid = random.choice(vgids)

View File

@ -33,14 +33,14 @@ class srvCtl:
# control server # control server
# #
# start # start idx base is 1
def dnodeStart(self, idx): def dnodeStart(self, idx):
if clusterDnodes.getModel() == 'cluster': if clusterDnodes.getModel() == 'cluster':
return clusterDnodes.starttaosd(idx) return clusterDnodes.starttaosd(idx)
return tdDnodes.starttaosd(idx) return tdDnodes.starttaosd(idx)
# stop # stop idx base is 1
def dnodeStop(self, idx): def dnodeStop(self, idx):
if clusterDnodes.getModel() == 'cluster': if clusterDnodes.getModel() == 'cluster':
return clusterDnodes.stoptaosd(idx) return clusterDnodes.stoptaosd(idx)