未验证 提交 ac89d00b 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #10706 from taosdata/xiaoping/2.4

[TS-1304]<test>: add test case
...@@ -198,6 +198,28 @@ class TDTestCase: ...@@ -198,6 +198,28 @@ class TDTestCase:
tdLog.info("case for TS-636") tdLog.info("case for TS-636")
self.escape_ascii() self.escape_ascii()
# TS-1304
tdLog.info("case for JIRA TS-1304")
tdSql.execute("create stable devices (ts timestamp,tempature int,humity float,`1name` int ) tags (`1devid` int,devname binary(20))")
tdSql.execute("insert into devices_001 using devices tags (111,'zzm') values (now,10001,1,1)")
tdSql.execute("insert into devices_001 using devices tags (222,'cxd') values (now + 1s,10002,2,2)")
tdSql.execute("insert into devices_001 using devices tags (333,'cyt') values (now + 2s,10002,2,2)")
tdSql.error("select 1name from devices")
tdSql.error("select 1name from devices_001")
tdSql.error("select 1devid from devices")
tdSql.error("select 1devid from devices_001")
tdSql.query("select `1name` from devices_001")
tdSql.checkRows(3)
tdSql.checkData(0, 0, 1)
tdSql.checkData(1, 0, 2)
tdSql.checkData(2, 0, 2)
tdSql.query("select `1devid` from devices_001")
tdSql.checkRows(1)
tdSql.checkData(0, 0, 111)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
...@@ -150,14 +150,21 @@ if __name__ == "__main__": ...@@ -150,14 +150,21 @@ if __name__ == "__main__":
cluster.init(numOfNodes, dataDir) cluster.init(numOfNodes, dataDir)
cluster.prepardBuild() cluster.prepardBuild()
startArbitrator = False
arbitratorHost = "tdnode1"
for i in range(numOfNodes): for i in range(numOfNodes):
if ucase.updatecfgDict.get('%d' % (i + 1)) != None: if ucase.updatecfgDict.get('%d' % (i + 1)) != None:
config = dict (ucase.updatecfgDict.get('%d' % (i + 1))) config = dict (ucase.updatecfgDict.get('%d' % (i + 1)))
print(config) print(config)
for key, value in config.items(): for key, value in config.items():
print(key, value, i + 1) if key == "arbitrator":
startArbitrator = True
arbitratorHost = value
cluster.cfg(key, value, i + 1) cluster.cfg(key, value, i + 1)
cluster.run() cluster.run()
if startArbitrator:
hostname=value.split(":")[0]
cluster.startArbitrator(hostname)
conn = cluster.conn conn = cluster.conn
except Exception as e: except Exception as e:
print(e.args) print(e.args)
......
...@@ -142,10 +142,8 @@ class BuildDockerCluser: ...@@ -142,10 +142,8 @@ class BuildDockerCluser:
print("create dnode tdnode%d" % i) print("create dnode tdnode%d" % i)
self.cursor.execute("create dnode tdnode%d" % i) self.cursor.execute("create dnode tdnode%d" % i)
def startArbitrator(self): def startArbitrator(self, hostname = 'tdnode1'):
for i in range(1, self.numOfNodes + 1): cmd = "docker exec -d $(docker ps|grep '%s'|awk '{print $1}') tarbitrator" % hostname
self.cfg("arbitrator", "tdnode1:6042", i)
cmd = "docker exec -d $(docker ps|grep tdnode1|awk '{print $1}') tarbitrator"
self.execCmd(cmd) self.execCmd(cmd)
def prepardBuild(self): def prepardBuild(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册