fix/TD-33265-arbitrator-covarage-add-case
This commit is contained in:
parent
151a39448f
commit
367bffd3f9
|
@ -0,0 +1,81 @@
|
||||||
|
import taos
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import glob
|
||||||
|
import shutil
|
||||||
|
import time
|
||||||
|
|
||||||
|
from frame.log import *
|
||||||
|
from frame.cases import *
|
||||||
|
from frame.sql import *
|
||||||
|
from frame.srvCtl import *
|
||||||
|
from frame.caseBase import *
|
||||||
|
from frame import *
|
||||||
|
from frame.autogen import *
|
||||||
|
from frame import epath
|
||||||
|
# from frame.server.dnodes import *
|
||||||
|
# from frame.server.cluster import *
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase(TBase):
|
||||||
|
|
||||||
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
|
updatecfgDict = {'dDebugFlag':131}
|
||||||
|
super(TDTestCase, self).init(conn, logSql, replicaVar=1, checkColName="c1")
|
||||||
|
|
||||||
|
self.valgrind = 0
|
||||||
|
self.db = "test"
|
||||||
|
self.stb = "meters"
|
||||||
|
self.childtable_count = 10
|
||||||
|
tdSql.init(conn.cursor(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.execute('CREATE DATABASE db vgroups 1 replica 2;')
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
while count < 100:
|
||||||
|
tdSql.query("show arbgroups;")
|
||||||
|
|
||||||
|
if tdSql.getData(0, 4) == 1:
|
||||||
|
break
|
||||||
|
|
||||||
|
tdLog.info("wait 1 seconds for is sync")
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.query("show db.vgroups;")
|
||||||
|
|
||||||
|
if(tdSql.getData(0, 4) == "follower") and (tdSql.getData(0, 6) == "leader"):
|
||||||
|
tdLog.info("stop dnode2")
|
||||||
|
sc.dnodeStop(2)
|
||||||
|
|
||||||
|
if(tdSql.getData(0, 6) == "follower") and (tdSql.getData(0, 4) == "leader"):
|
||||||
|
tdLog.info("stop dnode 3")
|
||||||
|
sc.dnodeStop(3)
|
||||||
|
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
while count < 100:
|
||||||
|
tdSql.query("show db.vgroups;")
|
||||||
|
|
||||||
|
if(tdSql.getData(0, 4) == "assigned ") or (tdSql.getData(0, 6) == "assigned "):
|
||||||
|
break
|
||||||
|
|
||||||
|
tdLog.info("wait 1 seconds for set assigned")
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
|
@ -11,6 +11,7 @@
|
||||||
#
|
#
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f multi-level/mlevel_basic.py -N 3 -L 3 -D 2
|
,,y,army,./pytest.sh python3 ./test.py -f multi-level/mlevel_basic.py -N 3 -L 3 -D 2
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f db-encrypt/basic.py -N 3 -M 3
|
,,y,army,./pytest.sh python3 ./test.py -f db-encrypt/basic.py -N 3 -M 3
|
||||||
|
,,y,army,./pytest.sh python3 ./test.py -f cluster/arbitrator.py -N 3
|
||||||
,,n,army,python3 ./test.py -f storage/s3/s3Basic.py -N 3
|
,,n,army,python3 ./test.py -f storage/s3/s3Basic.py -N 3
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f cluster/snapshot.py -N 3 -L 3 -D 2
|
,,y,army,./pytest.sh python3 ./test.py -f cluster/snapshot.py -N 3 -L 3 -D 2
|
||||||
,,y,army,./pytest.sh python3 ./test.py -f query/function/test_func_elapsed.py
|
,,y,army,./pytest.sh python3 ./test.py -f query/function/test_func_elapsed.py
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
###################################################################
|
###################################################################
|
||||||
from util.cases import *
|
from util.cases import *
|
||||||
from util.sql import *
|
from util.sql import *
|
||||||
|
from util.dnodes import *
|
||||||
|
from util.log import *
|
||||||
|
|
||||||
class TDTestCase:
|
class TDTestCase:
|
||||||
def init(self, conn, logSql, replicaVar=1):
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
|
@ -20,6 +22,26 @@ class TDTestCase:
|
||||||
def run(self):
|
def run(self):
|
||||||
tdSql.execute('CREATE DATABASE db vgroups 1 replica 2;')
|
tdSql.execute('CREATE DATABASE db vgroups 1 replica 2;')
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
tdSql.query("show db.vgroups;")
|
||||||
|
|
||||||
|
if(tdSql.queryResult[0][4] == "follower") and (tdSql.queryResult[0][6] == "leader"):
|
||||||
|
tdLog.info("stop dnode2")
|
||||||
|
sc.dnodeStop(2)
|
||||||
|
|
||||||
|
if(tdSql.queryResult[0][6] == "follower") and (tdSql.queryResult[0][4] == "leader"):
|
||||||
|
tdLog.info("stop dnode 3")
|
||||||
|
sc.dnodeStop(3)
|
||||||
|
|
||||||
|
tdLog.info("wait 10 seconds")
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
tdSql.query("show db.vgroups;")
|
||||||
|
|
||||||
|
if(tdSql.queryResult[0][4] != "assigned") and (tdSql.queryResult[0][6] != "assigned"):
|
||||||
|
tdLog.exit("failed to set aasigned")
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success(f"{__file__} successfully executed")
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
Loading…
Reference in New Issue