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

Merge pull request #10707 from taosdata/xiaoping/cases

[TS-1304]<test>: add test case
......@@ -198,6 +198,28 @@ class TDTestCase:
tdLog.info("case for TS-636")
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):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
......
......@@ -150,15 +150,22 @@ if __name__ == "__main__":
numOfNodes = ucase.updatecfgDict.get('numOfNodes')
cluster.init(numOfNodes, dataDir)
cluster.prepardBuild()
startArbitrator = False
arbitratorHost = "tdnode1"
for i in range(numOfNodes):
if ucase.updatecfgDict.get('%d' % (i + 1)) != None:
config = dict (ucase.updatecfgDict.get('%d' % (i + 1)))
print(config)
for key, value in config.items():
print(key, value, i + 1)
cluster.cfg(key, value, i + 1)
if key == "arbitrator":
startArbitrator = True
arbitratorHost = value
cluster.cfg(key, value, i + 1)
cluster.run()
if startArbitrator:
hostname=value.split(":")[0]
cluster.startArbitrator(hostname)
conn = cluster.conn
except Exception as e:
print(e.args)
......
......@@ -142,10 +142,8 @@ class BuildDockerCluser:
print("create dnode tdnode%d" % i)
self.cursor.execute("create dnode tdnode%d" % i)
def startArbitrator(self):
for i in range(1, self.numOfNodes + 1):
self.cfg("arbitrator", "tdnode1:6042", i)
cmd = "docker exec -d $(docker ps|grep tdnode1|awk '{print $1}') tarbitrator"
def startArbitrator(self, hostname = 'tdnode1'):
cmd = "docker exec -d $(docker ps|grep '%s'|awk '{print $1}') tarbitrator" % hostname
self.execCmd(cmd)
def prepardBuild(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册