diff --git a/tests/pytest/query/query.py b/tests/pytest/query/query.py index 31831cca9facea6aba1a6fc88a84a33a66583a5e..b581f30c245a87f9b845f7f0b01f034729da3ab7 100644 --- a/tests/pytest/query/query.py +++ b/tests/pytest/query/query.py @@ -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__) diff --git a/tests/pytest/test.py b/tests/pytest/test.py index b15c31dd23fdcf916dc9d42b015e0b2d95f2595c..d140ba08650dac0a37669d592b7c14b050cde5a5 100644 --- a/tests/pytest/test.py +++ b/tests/pytest/test.py @@ -149,15 +149,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) diff --git a/tests/pytest/util/dockerNodes.py b/tests/pytest/util/dockerNodes.py index 634acd48960b6920b2b9f3ec5161912d4d6c0c2a..7053955e6e7f22b00f8f0bc7d69002428043560f 100644 --- a/tests/pytest/util/dockerNodes.py +++ b/tests/pytest/util/dockerNodes.py @@ -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):