未验证 提交 acc2ea69 编写于 作者: H Hui Li 提交者: GitHub

Merge pull request #15054 from taosdata/test/update_cachelast

test:update cachemodel test case  ,and let it  takes effect in storage 
...@@ -56,6 +56,16 @@ class TDTestCase: ...@@ -56,6 +56,16 @@ class TDTestCase:
} }
return numbers.get(value, 'other') return numbers.get(value, 'other')
def getCacheModelNum(self,str):
numbers = {
"none" : 0,
"last_row" : 1,
"last_value" : 2,
"both" : 3
}
return numbers.get(str, 'other')
def prepare_datas(self): def prepare_datas(self):
for i in range(4): for i in range(4):
str = self.getCacheModelStr(i) str = self.getCacheModelStr(i)
...@@ -69,7 +79,7 @@ class TDTestCase: ...@@ -69,7 +79,7 @@ class TDTestCase:
tdSql.execute(" insert into tb1 values(now , %d, %f)" %(k,k*10) ) tdSql.execute(" insert into tb1 values(now , %d, %f)" %(k,k*10) )
tdSql.execute(" insert into tb2 values(now , %d, %f)" %(k,k*10) ) tdSql.execute(" insert into tb2 values(now , %d, %f)" %(k,k*10) )
def check_cache_last_sets(self): def check_cachemodel_sets(self):
# check cache_last value for database # check cache_last value for database
...@@ -84,52 +94,54 @@ class TDTestCase: ...@@ -84,52 +94,54 @@ class TDTestCase:
# print(cache_last_value) # print(cache_last_value)
if dbname in ["information_schema" , "performance_schema"]: if dbname in ["information_schema" , "performance_schema"]:
continue continue
cache_lasts[dbname]=cache_last_value cache_lasts[dbname]=self.getCacheModelNum(cache_last_value)
# cache_last_set value # cache_last_set value
for k , v in cache_lasts.items(): for k , v in cache_lasts.items():
if k=="testdb_"+str(v): if k=="testdb_"+str(self.getCacheModelStr(v)):
tdLog.info(" database %s cache_last value check pass, value is %s "%(k,v) ) tdLog.info(" database %s cache_last value check pass, value is %s "%(k,self.getCacheModelStr(v)) )
else: else:
tdLog.exit(" database %s cache_last value check fail, value is %s "%(k,v) ) tdLog.exit(" database %s cache_last value check fail, value is %s "%(k,self.getCacheModelStr(v)) )
# # check storage layer implementation # # check storage layer implementation
# buildPath = self.getBuildPath() buildPath = self.getBuildPath()
# if (buildPath == ""): if (buildPath == ""):
# tdLog.exit("taosd not found!") tdLog.exit("taosd not found!")
# else: else:
# tdLog.info("taosd found in %s" % buildPath) tdLog.info("taosd found in %s" % buildPath)
# dataPath = buildPath + "/../sim/dnode1/data" dataPath = buildPath + "/../sim/dnode1/data"
# abs_vnodePath = os.path.abspath(dataPath)+"/vnode/" abs_vnodePath = os.path.abspath(dataPath)+"/vnode/"
# tdLog.info("abs_vnodePath: %s" % abs_vnodePath) tdLog.info("abs_vnodePath: %s" % abs_vnodePath)
# tdSql.query(" show dnodes ") tdSql.query(" show dnodes ")
# dnode_id = tdSql.queryResult[0][0] dnode_id = tdSql.queryResult[0][0]
# for dbname in cache_lasts.keys(): for dbname in cache_lasts.keys():
# print(dbname) # print(dbname)
# tdSql.execute(" use %s" % dbname) tdSql.execute(" use %s" % dbname)
# tdSql.query(" show vgroups ") tdSql.query(" show vgroups ")
# vgroups_infos = tdSql.queryResult vgroups_infos = tdSql.queryResult
# for vgroup_info in vgroups_infos: for vgroup_info in vgroups_infos:
# vnode_json = abs_vnodePath + "/vnode" +f"{vgroup_info[0]}/" + "vnode.json" vnode_json = abs_vnodePath + "/vnode" +f"{vgroup_info[0]}/" + "vnode.json"
# vnode_info_of_db = f"cat {vnode_json}" vnode_info_of_db = f"cat {vnode_json}"
# vnode_info = subprocess.check_output(vnode_info_of_db, shell=True).decode("utf-8") vnode_info = subprocess.check_output(vnode_info_of_db, shell=True).decode("utf-8")
# infoDict = json.loads(vnode_info) infoDict = json.loads(vnode_info)
# vnode_json_of_dbname = f"{dnode_id}."+ dbname vnode_json_of_dbname = f"{dnode_id}."+ dbname
# config = infoDict["config"] config = infoDict["config"]
# if infoDict["config"]["dbname"] == vnode_json_of_dbname: if infoDict["config"]["dbname"] == vnode_json_of_dbname:
# if "cachelast" in infoDict["config"]: if "cacheLast" in infoDict["config"]:
# if int(infoDict["config"]["cachelast"]) != cache_lasts[dbname]: if int(infoDict["config"]["cacheLast"]) != cache_lasts[dbname]:
# tdLog.exit("cachelast value is error in vnode.json of vnode%d "%(vgroup_info[0])) tdLog.exit("cachemodel value is error in vnode.json of vnode%d "%(vgroup_info[0]))
# else: else:
# tdLog.exit("cachelast not found in vnode.json of vnode%d "%(vgroup_info[0])) tdLog.info("cachemodel value is success in vnode.json of vnode%d "%(vgroup_info[0]))
else:
def restart_check_cache_last_sets(self): tdLog.exit("cacheLast not found in vnode.json of vnode%d "%(vgroup_info[0]))
def restart_check_cachemodel_sets(self):
for i in range(3): for i in range(3):
tdSql.query("show dnodes") tdSql.query("show dnodes")
...@@ -137,14 +149,14 @@ class TDTestCase: ...@@ -137,14 +149,14 @@ class TDTestCase:
tdDnodes.stop(index) tdDnodes.stop(index)
tdDnodes.start(index) tdDnodes.start(index)
time.sleep(3) time.sleep(3)
self.check_cache_last_sets() self.check_cachemodel_sets()
def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring
self.illegal_params() self.illegal_params()
self.prepare_datas() self.prepare_datas()
self.check_cache_last_sets() self.check_cachemodel_sets()
self.restart_check_cache_last_sets() self.restart_check_cachemodel_sets()
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -10,7 +10,7 @@ python3 ./test.py -f 0-others/taosdMonitor.py ...@@ -10,7 +10,7 @@ python3 ./test.py -f 0-others/taosdMonitor.py
python3 ./test.py -f 0-others/udfTest.py python3 ./test.py -f 0-others/udfTest.py
python3 ./test.py -f 0-others/udf_create.py python3 ./test.py -f 0-others/udf_create.py
python3 ./test.py -f 0-others/udf_restart_taosd.py python3 ./test.py -f 0-others/udf_restart_taosd.py
python3 ./test.py -f 0-others/cachelast.py python3 ./test.py -f 0-others/cachemodel.py
python3 ./test.py -f 0-others/udf_cfg1.py python3 ./test.py -f 0-others/udf_cfg1.py
python3 ./test.py -f 0-others/udf_cfg2.py python3 ./test.py -f 0-others/udf_cfg2.py
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册