未验证 提交 2d872feb 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #1982 from taosdata/feature/pytest-output-sql-command-to-file

Feature/pytest output sql command to file
......@@ -34,6 +34,7 @@ class TDengineCursor(object):
self._block_rows = -1
self._block_iter = 0
self._affected_rows = 0
self._logfile = ""
if connection is not None:
self._connection = connection
......@@ -83,6 +84,9 @@ class TDengineCursor(object):
"""
pass
def log(self, logfile):
self._logfile = logfile
def close(self):
"""Close the cursor.
"""
......@@ -113,6 +117,11 @@ class TDengineCursor(object):
pass
res = CTaosInterface.query(self._connection._conn, stmt)
if (self._logfile):
with open(self._logfile, "a") as logfile:
logfile.write("%s;\n" % operation)
if res == 0:
if CTaosInterface.fieldsCount(self._connection._conn) == 0:
self._affected_rows += CTaosInterface.affectedRows(
......
......@@ -36,6 +36,7 @@ class TDengineCursor(object):
self._block_rows = -1
self._block_iter = 0
self._affected_rows = 0
self._logfile = ""
if connection is not None:
self._connection = connection
......@@ -85,6 +86,9 @@ class TDengineCursor(object):
"""
pass
def log(self, logfile):
self._logfile = logfile
def close(self):
"""Close the cursor.
"""
......@@ -121,6 +125,10 @@ class TDengineCursor(object):
res = CTaosInterface.query(self._connection._conn, stmt)
# print(" << Query ({}) Exec Done".format(localSeqNum))
if (self._logfile):
with open(self._logfile, "a") as logfile:
logfile.write("%s;\n" % operation)
if res == 0:
if CTaosInterface.fieldsCount(self._connection._conn) == 0:
self._affected_rows += CTaosInterface.affectedRows(
......
......@@ -19,9 +19,9 @@ from util.sql import tdSql
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
try:
......
......@@ -19,9 +19,9 @@ from util.sql import tdSql
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
print("==========step1")
......
......@@ -9,9 +9,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
self.types = [
"int",
"bigint",
......
......@@ -9,9 +9,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
self.types = [
"int",
"bigint",
......
......@@ -19,9 +19,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -23,9 +23,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
......
......@@ -19,9 +19,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......
......@@ -20,9 +20,9 @@ from util.dnodes import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
self.ntables = 1
......@@ -45,7 +45,8 @@ class TDTestCase:
tdLog.info("================= step2")
tdLog.info('insert data until the first commit')
dnodesDir = tdDnodes.getDnodesRootDir()
dataDir = dnodesDir + '/dnode1/data/data'
dataDir = dnodesDir + '/dnode1/data/vnode'
tdLog.info('CBD: dataDir=%s' % dataDir)
startTime = self.startTime
rid0 = 1
while (True):
......
......@@ -18,9 +18,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -7,9 +7,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -7,9 +7,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -7,9 +7,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -7,9 +7,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -7,9 +7,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -7,9 +7,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -19,9 +19,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -20,9 +20,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -20,9 +20,9 @@ from util.sql import tdSql
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -18,9 +18,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -18,9 +18,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -18,9 +18,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -7,9 +7,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -7,9 +7,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -19,9 +19,9 @@ from util.sql import tdSql
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -19,9 +19,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -108,11 +108,23 @@ class Test:
tdDnodes.start(1)
tdSql.prepare()
def delete_datafiles(self):
tdLog.info("delete data files")
dnodesDir = tdDnodes.getDnodesRootDir()
dataDir = dnodesDir + '/dnode1/*'
deleteCmd = 'rm -rf %s' % dataDir
os.system(deleteCmd)
self.current_tb = ""
self.last_tb = ""
self.written = 0
tdDnodes.start(1)
tdSql.prepare()
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......@@ -129,10 +141,11 @@ class TDTestCase:
7: test.drop_table,
8: test.reset_query_cache,
9: test.reset_database,
10: test.delete_datafiles,
}
for x in range(1, 100):
r = random.randint(1, 9)
r = random.randint(1, 10)
tdLog.notice("iteration %d run func %d" % (x, r))
switch.get(r, lambda: "ERROR")()
......
......@@ -19,9 +19,9 @@ from util.sql import tdSql
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -20,9 +20,9 @@ from util.sql import tdSql
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -10,140 +10,133 @@ from util.sql import *
class TDTestCase:
def init( self, conn ):
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def getLimitFromSourceCode( self, name ):
def getLimitFromSourceCode(self, name):
cmd = "grep -w '#define %s' ../../src/inc/taosdef.h|awk '{print $3}'" % name
return int(subprocess.check_output(cmd, shell=True))
def generateString( self, length ):
def generateString(self, length):
chars = string.ascii_uppercase + string.ascii_lowercase
v = ""
for i in range( length ):
v += random.choice( chars )
for i in range(length):
v += random.choice(chars)
return v
def checkTagBoundaries( self ):
tdLog.debug( "checking tag boundaries" )
def checkTagBoundaries(self):
tdLog.debug("checking tag boundaries")
tdSql.prepare()
maxTags = self.getLimitFromSourceCode( 'TSDB_MAX_TAGS' )
totalTagsLen = self.getLimitFromSourceCode( 'TSDB_MAX_TAGS_LEN' )
tdLog.notice( "max tags is %d" % maxTags )
tdLog.notice( "max total tag length is %d" % totalTagsLen )
maxTags = self.getLimitFromSourceCode('TSDB_MAX_TAGS')
totalTagsLen = self.getLimitFromSourceCode('TSDB_MAX_TAGS_LEN')
tdLog.notice("max tags is %d" % maxTags)
tdLog.notice("max total tag length is %d" % totalTagsLen)
# for binary tags, 2 bytes are used for length
tagLen = (totalTagsLen - maxTags * 2) // maxTags
firstTagLen = totalTagsLen - 2 * maxTags - tagLen * (maxTags - 1)
sql = "create table cars(ts timestamp, f int) tags(t0 binary(%d)" % firstTagLen
for i in range( 1, maxTags ):
for i in range(1, maxTags):
sql += ", t%d binary(%d)" % (i, tagLen)
sql += ");"
tdLog.debug( "creating super table: " + sql )
tdSql.execute( sql )
tdSql.query( 'show stables' )
tdSql.checkRows( 1 )
tdLog.debug("creating super table: " + sql)
tdSql.execute(sql)
tdSql.query('show stables')
tdSql.checkRows(1)
for i in range( 10 ):
for i in range(10):
sql = "create table car%d using cars tags('%d'" % (i, i)
sql += ", '0'" * (maxTags - 1) + ");"
tdLog.debug( "creating table: " + sql )
tdSql.execute( sql )
tdLog.debug("creating table: " + sql)
tdSql.execute(sql)
sql = "insert into car%d values(now, 0);" % i
tdLog.debug( "inserting data: " + sql )
tdSql.execute( sql )
tdSql.query( 'show tables' )
tdLog.info( 'tdSql.checkRow(10)' )
tdSql.checkRows( 10 )
tdLog.debug("inserting data: " + sql)
tdSql.execute(sql)
tdSql.query( 'select * from cars;' )
tdSql.checkRows( 10 )
tdSql.query('show tables')
tdLog.info('tdSql.checkRow(10)')
tdSql.checkRows(10)
tdSql.query('select * from cars;')
tdSql.checkRows(10)
def checkColumnBoundaries( self ):
tdLog.debug( "checking column boundaries" )
def checkColumnBoundaries(self):
tdLog.debug("checking column boundaries")
tdSql.prepare()
# one column is for timestamp
maxCols = self.getLimitFromSourceCode( 'TSDB_MAX_COLUMNS' ) - 1
maxCols = self.getLimitFromSourceCode('TSDB_MAX_COLUMNS') - 1
sql = "create table cars (ts timestamp"
for i in range( maxCols ):
for i in range(maxCols):
sql += ", c%d int" % i
sql += ");"
tdSql.execute( sql )
tdSql.query( 'show tables' )
tdSql.checkRows( 1 )
tdSql.execute(sql)
tdSql.query('show tables')
tdSql.checkRows(1)
sql = "insert into cars values (now"
for i in range( maxCols ):
for i in range(maxCols):
sql += ", %d" % i
sql += ");"
tdSql.execute( sql )
tdSql.query( 'select * from cars' )
tdSql.checkRows( 1 )
tdSql.execute(sql)
tdSql.query('select * from cars')
tdSql.checkRows(1)
def checkTableNameBoundaries( self ):
tdLog.debug( "checking table name boundaries" )
def checkTableNameBoundaries(self):
tdLog.debug("checking table name boundaries")
tdSql.prepare()
maxTableNameLen = self.getLimitFromSourceCode( 'TSDB_TABLE_NAME_LEN' )
tdLog.notice( "table name max length is %d" % maxTableNameLen )
name = self.generateString( maxTableNameLen - 1)
tdLog.info( "table name is '%s'" % name )
maxTableNameLen = self.getLimitFromSourceCode('TSDB_TABLE_NAME_LEN')
tdLog.notice("table name max length is %d" % maxTableNameLen)
tdSql.execute( "create table %s (ts timestamp, value int)" % name )
tdSql.execute( "insert into %s values(now, 0)" % name )
name = self.generateString(maxTableNameLen - 1)
tdLog.info("table name is '%s'" % name)
tdSql.query( 'show tables' )
tdSql.checkRows( 1 )
tdSql.execute("create table %s (ts timestamp, value int)" % name)
tdSql.execute("insert into %s values(now, 0)" % name)
tdSql.query( 'select * from %s' % name )
tdSql.checkRows( 1 )
tdSql.query('show tables')
tdSql.checkRows(1)
tdSql.query('select * from %s' % name)
tdSql.checkRows(1)
def checkRowBoundaries( self ):
tdLog.debug( "checking row boundaries" )
def checkRowBoundaries(self):
tdLog.debug("checking row boundaries")
tdSql.prepare()
# 8 bytes for timestamp
maxRowSize = 65536 - 8
maxCols = self.getLimitFromSourceCode( 'TSDB_MAX_COLUMNS' ) - 1
maxCols = self.getLimitFromSourceCode('TSDB_MAX_COLUMNS') - 1
# for binary cols, 2 bytes are used for length
colLen = (maxRowSize - maxCols * 2) // maxCols
firstColLen = maxRowSize - 2 * maxCols - colLen * (maxCols - 1)
sql = "create table cars (ts timestamp, c0 binary(%d)" % firstColLen
for i in range( 1, maxCols ):
for i in range(1, maxCols):
sql += ", c%d binary(%d)" % (i, colLen)
sql += ");"
tdSql.execute( sql )
tdSql.query( 'show tables' )
tdSql.checkRows( 1 )
tdSql.execute(sql)
tdSql.query('show tables')
tdSql.checkRows(1)
col = self.generateString( firstColLen )
col = self.generateString(firstColLen)
sql = "insert into cars values (now, '%s'" % col
col = self.generateString( colLen )
for i in range( 1, maxCols ):
sql += ", '%s'" % col
col = self.generateString(colLen)
for i in range(1, maxCols):
sql += ", '%s'" % col
sql += ");"
tdLog.info( sql );
tdSql.execute( sql )
tdSql.query( "select * from cars" )
tdSql.checkRows( 1 )
tdLog.info(sql)
tdSql.execute(sql)
tdSql.query("select * from cars")
tdSql.checkRows(1)
def run(self):
self.checkTagBoundaries()
......@@ -151,7 +144,6 @@ class TDTestCase:
self.checkTableNameBoundaries()
self.checkRowBoundaries()
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
......@@ -10,9 +10,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
......@@ -8,9 +8,9 @@ from util.sql import *
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import taos
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
print("==============step1")
print("prepare data")
for x in range(0, 1000000):
tb_name = "tb%d" % x
tdLog.info("create table %s (ts timestamp, i int)" % tb_name)
tdSql.execute("create table %s (ts timestamp, i int)" % tb_name)
tdLog.info("insert into %s values(now, 1)" % tb_name)
tdSql.execute("insert into %s values(now, 1)" % tb_name)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
......@@ -19,9 +19,9 @@ from util.sql import tdSql
class TDTestCase:
def init(self, conn):
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
tdSql.init(conn.cursor(), logSql)
def run(self):
tdSql.prepare()
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册