提交 a8352d8c 编写于 作者: J jiajingbin

[TD-5314]: autotest cases

上级 ad55c1a7
此差异已折叠。
...@@ -65,7 +65,7 @@ class TDSql: ...@@ -65,7 +65,7 @@ class TDSql:
self.queryResult = None self.queryResult = None
tdLog.info("sql:%s, expect error occured" % (sql)) tdLog.info("sql:%s, expect error occured" % (sql))
def query(self, sql): def query(self, sql, row_tag=None):
self.sql = sql self.sql = sql
try: try:
self.cursor.execute(sql) self.cursor.execute(sql)
...@@ -77,21 +77,27 @@ class TDSql: ...@@ -77,21 +77,27 @@ class TDSql:
args = (caller.filename, caller.lineno, sql, repr(e)) args = (caller.filename, caller.lineno, sql, repr(e))
tdLog.notice("%s(%d) failed: sql:%s, %s" % args) tdLog.notice("%s(%d) failed: sql:%s, %s" % args)
raise Exception(repr(e)) raise Exception(repr(e))
if row_tag:
return self.queryResult
return self.queryRows return self.queryRows
def getColNameList(self, sql): def getColNameList(self, sql, col_tag=None):
self.sql = sql self.sql = sql
try: try:
col_name_list = [] col_name_list = []
col_type_list = []
self.cursor.execute(sql) self.cursor.execute(sql)
self.queryCols = self.cursor.description self.queryCols = self.cursor.description
for query_col in self.queryCols: for query_col in self.queryCols:
col_name_list.append(query_col[0]) col_name_list.append(query_col[0])
col_type_list.append(query_col[1])
except Exception as e: except Exception as e:
caller = inspect.getframeinfo(inspect.stack()[1][0]) caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, sql, repr(e)) args = (caller.filename, caller.lineno, sql, repr(e))
tdLog.notice("%s(%d) failed: sql:%s, %s" % args) tdLog.notice("%s(%d) failed: sql:%s, %s" % args)
raise Exception(repr(e)) raise Exception(repr(e))
if col_tag:
return col_name_list, col_type_list
return col_name_list return col_name_list
def waitedQuery(self, sql, expectRows, timeout): def waitedQuery(self, sql, expectRows, timeout):
...@@ -232,6 +238,22 @@ class TDSql: ...@@ -232,6 +238,22 @@ class TDSql:
args = (caller.filename, caller.lineno, self.sql, col_name_list, expect_col_name_list) args = (caller.filename, caller.lineno, self.sql, col_name_list, expect_col_name_list)
tdLog.exit("%s(%d) failed: sql:%s, col_name_list:%s != expect_col_name_list:%s" % args) tdLog.exit("%s(%d) failed: sql:%s, col_name_list:%s != expect_col_name_list:%s" % args)
def checkEqual(self, elm, expect_elm):
if elm == expect_elm:
tdLog.info("sql:%s, elm:%s == expect_elm:%s" % (self.sql, elm, expect_elm))
else:
caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, self.sql, elm, expect_elm)
tdLog.exit("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args)
def checkNotEqual(self, elm, expect_elm):
if elm != expect_elm:
tdLog.info("sql:%s, elm:%s != expect_elm:%s" % (self.sql, elm, expect_elm))
else:
caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, self.sql, elm, expect_elm)
tdLog.exit("%s(%d) failed: sql:%s, elm:%s == expect_elm:%s" % args)
def taosdStatus(self, state): def taosdStatus(self, state):
tdLog.sleep(5) tdLog.sleep(5)
pstate = 0 pstate = 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册