提交 bc7e5187 编写于 作者: S Shuduo Sang

fix variable issie.

上级 344c0655
...@@ -44,11 +44,15 @@ class Test (threading.Thread): ...@@ -44,11 +44,15 @@ class Test (threading.Thread):
return return
else: else:
tdLog.info("will create table %s" % current_tb) tdLog.info("will create table %s" % current_tb)
tdSql.execute(
'create table %s (ts timestamp, speed int)' % try:
current_tb) tdSql.execute(
last_tb = current_tb 'create table %s (ts timestamp, speed int)' %
written = 0 current_tb)
last_tb = current_tb
written = 0
except Exception as e:
tdLog.info(repr(e))
def insert_data(self): def insert_data(self):
tdLog.info("insert_data") tdLog.info("insert_data")
...@@ -85,6 +89,7 @@ class Test (threading.Thread): ...@@ -85,6 +89,7 @@ class Test (threading.Thread):
global last_tb global last_tb
global last_stb global last_stb
global written global written
current_stb = "stb%d" % int(round(time.time() * 1000)) current_stb = "stb%d" % int(round(time.time() * 1000))
if (current_stb == last_stb): if (current_stb == last_stb):
...@@ -104,7 +109,7 @@ class Test (threading.Thread): ...@@ -104,7 +109,7 @@ class Test (threading.Thread):
tdSql.execute( tdSql.execute(
"insert into %s values (now, 27, '我是nchar字符串')" % "insert into %s values (now, 27, '我是nchar字符串')" %
last_tb) last_tb)
self.written = self.written + 1 written = written + 1
def drop_stable(self): def drop_stable(self):
...@@ -135,7 +140,7 @@ class Test (threading.Thread): ...@@ -135,7 +140,7 @@ class Test (threading.Thread):
tdDnodes.forcestop(1) tdDnodes.forcestop(1)
tdDnodes.start(1) tdDnodes.start(1)
tdLog.sleep(5) tdLog.sleep(10)
def drop_table(self): def drop_table(self):
tdLog.info("drop_table") tdLog.info("drop_table")
...@@ -148,7 +153,6 @@ class Test (threading.Thread): ...@@ -148,7 +153,6 @@ class Test (threading.Thread):
tdSql.execute("drop table %s" % last_tb) tdSql.execute("drop table %s" % last_tb)
last_tb = "" last_tb = ""
written = 0 written = 0
tdLog.sleep(self.sleepTime)
def query_data_from_stable(self): def query_data_from_stable(self):
...@@ -175,11 +179,13 @@ class Test (threading.Thread): ...@@ -175,11 +179,13 @@ class Test (threading.Thread):
def reset_database(self): def reset_database(self):
tdLog.info("reset_database") tdLog.info("reset_database")
global last_tb global last_tb
global last_stb
global written global written
tdDnodes.forcestop(1) tdDnodes.forcestop(1)
tdDnodes.deploy(1) tdDnodes.deploy(1)
last_tb = "" last_tb = ""
last_stb = ""
written = 0 written = 0
tdDnodes.start(1) tdDnodes.start(1)
tdSql.prepare() tdSql.prepare()
...@@ -197,6 +203,7 @@ class Test (threading.Thread): ...@@ -197,6 +203,7 @@ class Test (threading.Thread):
last_tb = "" last_tb = ""
written = 0 written = 0
tdDnodes.start(1) tdDnodes.start(1)
tdLog.sleep(10)
tdSql.prepare() tdSql.prepare()
def run(self): def run(self):
......
...@@ -168,8 +168,10 @@ class Test: ...@@ -168,8 +168,10 @@ class Test:
os.system(deleteCmd) os.system(deleteCmd)
self.last_tb = "" self.last_tb = ""
self.last_stb = ""
self.written = 0 self.written = 0
tdDnodes.start(1) tdDnodes.start(1)
tdLog.sleep(10)
tdSql.prepare() tdSql.prepare()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册