未验证 提交 917b6c44 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

test: insert/binary.py use same logic with 3.0" (#11458)

* [TD-13558]<feature>: remove taosSystem() in 2.x

* test: insert/binary.py use same logic with 3.0
上级 02922f7f
...@@ -14,6 +14,23 @@ class TDTestCase: ...@@ -14,6 +14,23 @@ class TDTestCase:
tdLog.debug("start to execute %s" % __file__) tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql) tdSql.init(conn.cursor(), logSql)
def getPath(self, tool="taos"):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
paths = []
for root, dirs, files in os.walk(projPath):
if ((tool) in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
paths.append(os.path.join(root, tool))
break
return paths[0]
def run(self): def run(self):
tdSql.prepare() tdSql.prepare()
...@@ -54,17 +71,27 @@ class TDTestCase: ...@@ -54,17 +71,27 @@ class TDTestCase:
tdLog.info("tdSql.checkData(0, 0, '34567')") tdLog.info("tdSql.checkData(0, 0, '34567')")
tdSql.checkData(0, 0, '34567') tdSql.checkData(0, 0, '34567')
tdLog.info("insert into tb values (now+4a, \"'';\")") tdLog.info("insert into tb values (now+4a, \"'';\")")
if platform.system() == "Linux": if platform.system() == "Linux":
config_dir = subprocess.check_output(str("ps -ef |grep dnode1|grep -v grep |awk '{print $NF}'"), stderr=subprocess.STDOUT, shell=True).decode('utf-8').replace('\n', '') config_dir = subprocess.check_output(
result = ''.join(os.popen(r"""taos -s "insert into db.tb values (now+4a, \"'';\")" -c %s"""%(config_dir)).readlines()) str("ps -ef |grep dnode1|grep -v grep |awk '{print $NF}'"),
if "Query OK" not in result: tdLog.exit("err:insert '';") stderr=subprocess.STDOUT,
tdLog.info('drop database db') shell=True).decode('utf-8').replace(
tdSql.execute('drop database db') '\n',
tdLog.info('show databases') '')
tdSql.query('show databases')
tdLog.info('tdSql.checkRow(0)') binPath = self.getPath("taos")
tdSql.checkRows(0) if (binPath == ""):
# convert end tdLog.exit("taos not found!")
else:
tdLog.info("taos found: %s" % binPath)
result = ''.join(
os.popen(
r"""%s -s "insert into db.tb values (now+4a, \"'';\")" -c %s""" %
(binPath, (config_dir))).readlines())
if "Query OK" not in result:
tdLog.exit("err:insert '';")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册