test: modify testcase of hot refresh config

This commit is contained in:
chenhaoran 2024-01-02 16:26:46 +08:00
parent 762f1eac1e
commit 1a265a2e9d
2 changed files with 28 additions and 6 deletions

View File

@ -506,7 +506,23 @@ class TDCom:
if ("packaging" not in rootRealPath): if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")] buildPath = root[:len(root) - len("/build/bin")]
break break
if platform.system().lower() == 'windows':
win_sep = "\\"
buildPath = buildPath.replace(win_sep,'/')
return buildPath return buildPath
def getTaosdPath(self, dnodeID="dnode1"):
buildPath = self.getBuildPath()
print("123456",buildPath)
if (buildPath == ""):
tdLog.exit("taosd not found!")
else:
tdLog.info("taosd found in %s" % buildPath)
taosdPath = buildPath + "/../sim/" + dnodeID
tdLog.info("taosdPath: %s" % taosdPath)
return taosdPath
def getClientCfgPath(self): def getClientCfgPath(self):
buildPath = self.getBuildPath() buildPath = self.getBuildPath()

View File

@ -201,6 +201,17 @@ class TDTestCase:
tdSql.error(f'alter {dnode} "{name} {v}";') tdSql.error(f'alter {dnode} "{name} {v}";')
def run(self): def run(self):
# reset log
taosdPath = tdCom.getTaosdPath()
print(taosdPath,"123")
taosdLogAbsoluteFilename = taosdPath + "/log/" + "taosdlog*"
print(taosdLogAbsoluteFilename)
tdSql.execute("alter all dnodes 'resetlog';")
r = subprocess.Popen("cat {} | grep 'reset log file'".format(taosdLogAbsoluteFilename), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = r.communicate()
assert('reset log file' in stdout.decode())
for key in self.configration_dic: for key in self.configration_dic:
if "cli" == key: if "cli" == key:
for item in self.configration_dic[key]: for item in self.configration_dic[key]:
@ -214,12 +225,7 @@ class TDTestCase:
self.svr_check(item["name"], item["alias"], item["except_values"], True) self.svr_check(item["name"], item["alias"], item["except_values"], True)
else: else:
raise Exception(f"unknown key: {key}") raise Exception(f"unknown key: {key}")
# reset log
path = os.sep.join([tdDnodes.getDnodesRootDir(), "dnode1", "log", "taosdlog.*"])
tdSql.execute("alter all dnodes 'resetlog';")
r = subprocess.Popen("cat {} | grep 'reset log file'".format(path), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = r.communicate()
assert('reset log file' in stdout.decode())
def stop(self): def stop(self):
tdSql.close() tdSql.close()