From fd76b5f71d3992d834e663c0e8a19474ccf4eb75 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 27 Apr 2020 14:49:18 +0800 Subject: [PATCH 1/2] port import_merge python testcase for 2.0 [TD-205] --- .travis.yml | 7 +- tests/pytest/fulltest.sh | 75 +++++++++++++++ tests/pytest/import_merge/__init__.py | 0 tests/pytest/import_merge/importBlock1H.py | 70 ++++++++++++++ tests/pytest/import_merge/importBlock1HO.py | 73 +++++++++++++++ tests/pytest/import_merge/importBlock1HPO.py | 75 +++++++++++++++ tests/pytest/import_merge/importBlock1S.py | 73 +++++++++++++++ tests/pytest/import_merge/importBlock1Sub.py | 73 +++++++++++++++ tests/pytest/import_merge/importBlock1T.py | 70 ++++++++++++++ tests/pytest/import_merge/importBlock1TO.py | 73 +++++++++++++++ tests/pytest/import_merge/importBlock1TPO.py | 75 +++++++++++++++ tests/pytest/import_merge/importBlock2H.py | 70 ++++++++++++++ tests/pytest/import_merge/importBlock2HO.py | 73 +++++++++++++++ tests/pytest/import_merge/importBlock2HPO.py | 75 +++++++++++++++ tests/pytest/import_merge/importBlock2S.py | 73 +++++++++++++++ tests/pytest/import_merge/importBlock2Sub.py | 73 +++++++++++++++ tests/pytest/import_merge/importBlock2T.py | 70 ++++++++++++++ tests/pytest/import_merge/importBlock2TO.py | 73 +++++++++++++++ tests/pytest/import_merge/importBlock2TPO.py | 75 +++++++++++++++ .../pytest/import_merge/importBlockbetween.py | 76 ++++++++++++++++ tests/pytest/import_merge/importCacheFileH.py | 86 ++++++++++++++++++ .../pytest/import_merge/importCacheFileHO.py | 89 ++++++++++++++++++ .../pytest/import_merge/importCacheFileHPO.py | 91 +++++++++++++++++++ tests/pytest/import_merge/importCacheFileS.py | 89 ++++++++++++++++++ .../pytest/import_merge/importCacheFileSub.py | 89 ++++++++++++++++++ tests/pytest/import_merge/importCacheFileT.py | 86 ++++++++++++++++++ .../pytest/import_merge/importCacheFileTO.py | 89 ++++++++++++++++++ .../pytest/import_merge/importCacheFileTPO.py | 91 +++++++++++++++++++ tests/pytest/import_merge/importDataH2.py | 91 +++++++++++++++++++ tests/pytest/import_merge/importDataHO.py | 80 ++++++++++++++++ tests/pytest/import_merge/importDataHO2.py | 80 ++++++++++++++++ tests/pytest/import_merge/importDataHPO.py | 82 +++++++++++++++++ tests/pytest/import_merge/importDataLastH.py | 76 ++++++++++++++++ tests/pytest/import_merge/importDataLastHO.py | 79 ++++++++++++++++ .../pytest/import_merge/importDataLastHPO.py | 81 +++++++++++++++++ tests/pytest/import_merge/importDataLastS.py | 79 ++++++++++++++++ .../pytest/import_merge/importDataLastSub.py | 79 ++++++++++++++++ tests/pytest/import_merge/importDataLastT.py | 72 +++++++++++++++ tests/pytest/import_merge/importDataLastTO.py | 75 +++++++++++++++ .../pytest/import_merge/importDataLastTPO.py | 77 ++++++++++++++++ tests/pytest/import_merge/importDataS.py | 75 +++++++++++++++ tests/pytest/import_merge/importDataSub.py | 80 ++++++++++++++++ tests/pytest/import_merge/importDataT.py | 72 +++++++++++++++ tests/pytest/import_merge/importDataTO.py | 75 +++++++++++++++ tests/pytest/import_merge/importDataTPO.py | 78 ++++++++++++++++ tests/pytest/import_merge/importHORestart.py | 66 ++++++++++++++ tests/pytest/import_merge/importHPORestart.py | 69 ++++++++++++++ tests/pytest/import_merge/importHRestart.py | 65 +++++++++++++ tests/pytest/import_merge/importHead.py | 68 ++++++++++++++ .../pytest/import_merge/importHeadOverlap.py | 63 +++++++++++++ .../import_merge/importHeadPartOverlap.py | 67 ++++++++++++++ tests/pytest/import_merge/importLastH.py | 72 +++++++++++++++ tests/pytest/import_merge/importLastHO.py | 75 +++++++++++++++ tests/pytest/import_merge/importLastHPO.py | 77 ++++++++++++++++ tests/pytest/import_merge/importLastS.py | 74 +++++++++++++++ tests/pytest/import_merge/importLastSub.py | 75 +++++++++++++++ tests/pytest/import_merge/importLastT.py | 76 ++++++++++++++++ tests/pytest/import_merge/importLastTO.py | 79 ++++++++++++++++ tests/pytest/import_merge/importLastTPO.py | 80 ++++++++++++++++ tests/pytest/import_merge/importSRestart.py | 73 +++++++++++++++ tests/pytest/import_merge/importSpan.py | 68 ++++++++++++++ tests/pytest/import_merge/importSubRestart.py | 73 +++++++++++++++ tests/pytest/import_merge/importTORestart.py | 73 +++++++++++++++ tests/pytest/import_merge/importTPORestart.py | 75 +++++++++++++++ tests/pytest/import_merge/importTRestart.py | 72 +++++++++++++++ tests/pytest/import_merge/importTail.py | 68 ++++++++++++++ .../pytest/import_merge/importTailOverlap.py | 70 ++++++++++++++ .../import_merge/importTailPartOverlap.py | 70 ++++++++++++++ tests/pytest/import_merge/importToCommit.py | 81 +++++++++++++++++ tests/pytest/simpletest.sh | 25 ----- tests/pytest/smoketest.sh | 55 +++++++++++ tests/test-all.sh | 7 +- 72 files changed, 5149 insertions(+), 30 deletions(-) create mode 100755 tests/pytest/fulltest.sh create mode 100644 tests/pytest/import_merge/__init__.py create mode 100644 tests/pytest/import_merge/importBlock1H.py create mode 100644 tests/pytest/import_merge/importBlock1HO.py create mode 100644 tests/pytest/import_merge/importBlock1HPO.py create mode 100644 tests/pytest/import_merge/importBlock1S.py create mode 100644 tests/pytest/import_merge/importBlock1Sub.py create mode 100644 tests/pytest/import_merge/importBlock1T.py create mode 100644 tests/pytest/import_merge/importBlock1TO.py create mode 100644 tests/pytest/import_merge/importBlock1TPO.py create mode 100644 tests/pytest/import_merge/importBlock2H.py create mode 100644 tests/pytest/import_merge/importBlock2HO.py create mode 100644 tests/pytest/import_merge/importBlock2HPO.py create mode 100644 tests/pytest/import_merge/importBlock2S.py create mode 100644 tests/pytest/import_merge/importBlock2Sub.py create mode 100644 tests/pytest/import_merge/importBlock2T.py create mode 100644 tests/pytest/import_merge/importBlock2TO.py create mode 100644 tests/pytest/import_merge/importBlock2TPO.py create mode 100644 tests/pytest/import_merge/importBlockbetween.py create mode 100644 tests/pytest/import_merge/importCacheFileH.py create mode 100644 tests/pytest/import_merge/importCacheFileHO.py create mode 100644 tests/pytest/import_merge/importCacheFileHPO.py create mode 100644 tests/pytest/import_merge/importCacheFileS.py create mode 100644 tests/pytest/import_merge/importCacheFileSub.py create mode 100644 tests/pytest/import_merge/importCacheFileT.py create mode 100644 tests/pytest/import_merge/importCacheFileTO.py create mode 100644 tests/pytest/import_merge/importCacheFileTPO.py create mode 100644 tests/pytest/import_merge/importDataH2.py create mode 100644 tests/pytest/import_merge/importDataHO.py create mode 100644 tests/pytest/import_merge/importDataHO2.py create mode 100644 tests/pytest/import_merge/importDataHPO.py create mode 100644 tests/pytest/import_merge/importDataLastH.py create mode 100644 tests/pytest/import_merge/importDataLastHO.py create mode 100644 tests/pytest/import_merge/importDataLastHPO.py create mode 100644 tests/pytest/import_merge/importDataLastS.py create mode 100644 tests/pytest/import_merge/importDataLastSub.py create mode 100644 tests/pytest/import_merge/importDataLastT.py create mode 100644 tests/pytest/import_merge/importDataLastTO.py create mode 100644 tests/pytest/import_merge/importDataLastTPO.py create mode 100644 tests/pytest/import_merge/importDataS.py create mode 100644 tests/pytest/import_merge/importDataSub.py create mode 100644 tests/pytest/import_merge/importDataT.py create mode 100644 tests/pytest/import_merge/importDataTO.py create mode 100644 tests/pytest/import_merge/importDataTPO.py create mode 100644 tests/pytest/import_merge/importHORestart.py create mode 100644 tests/pytest/import_merge/importHPORestart.py create mode 100644 tests/pytest/import_merge/importHRestart.py create mode 100644 tests/pytest/import_merge/importHead.py create mode 100644 tests/pytest/import_merge/importHeadOverlap.py create mode 100644 tests/pytest/import_merge/importHeadPartOverlap.py create mode 100644 tests/pytest/import_merge/importLastH.py create mode 100644 tests/pytest/import_merge/importLastHO.py create mode 100644 tests/pytest/import_merge/importLastHPO.py create mode 100644 tests/pytest/import_merge/importLastS.py create mode 100644 tests/pytest/import_merge/importLastSub.py create mode 100644 tests/pytest/import_merge/importLastT.py create mode 100644 tests/pytest/import_merge/importLastTO.py create mode 100644 tests/pytest/import_merge/importLastTPO.py create mode 100644 tests/pytest/import_merge/importSRestart.py create mode 100644 tests/pytest/import_merge/importSpan.py create mode 100644 tests/pytest/import_merge/importSubRestart.py create mode 100644 tests/pytest/import_merge/importTORestart.py create mode 100644 tests/pytest/import_merge/importTPORestart.py create mode 100644 tests/pytest/import_merge/importTRestart.py create mode 100644 tests/pytest/import_merge/importTail.py create mode 100644 tests/pytest/import_merge/importTailOverlap.py create mode 100644 tests/pytest/import_merge/importTailPartOverlap.py create mode 100644 tests/pytest/import_merge/importToCommit.py delete mode 100755 tests/pytest/simpletest.sh create mode 100755 tests/pytest/smoketest.sh diff --git a/.travis.yml b/.travis.yml index 39fddc20c9..7df3a7d7fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,10 +46,10 @@ matrix: pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/ cd ${TRAVIS_BUILD_DIR}/tests - ./test-all.sh || travis_terminate $? + ./test-all.sh $TRAVIS_EVENT_TYPE || travis_terminate $? cd ${TRAVIS_BUILD_DIR}/tests/pytest - ./simpletest.sh -g 2>&1 | tee mem-error-out.txt + ./smoketest.sh -g 2>&1 | tee mem-error-out.txt sleep 1 # Color setting @@ -86,13 +86,12 @@ matrix: addons: coverity_scan: - # GitHub project metadata # ** specific to your project ** project: name: TDengine version: 2.x - description: taosdata/TDengine + description: TDengine # Where email notification of build analysis results will be sent notification_email: sdsang@taosdata.com diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh new file mode 100755 index 0000000000..1b879b3cc6 --- /dev/null +++ b/tests/pytest/fulltest.sh @@ -0,0 +1,75 @@ +#!/bin/bash +python3 ./test.py $1 -f insert/basic.py +python3 ./test.py $1 -f insert/int.py +python3 ./test.py $1 -f insert/float.py +python3 ./test.py $1 -f insert/bigint.py +python3 ./test.py $1 -f insert/bool.py +python3 ./test.py $1 -f insert/double.py +python3 ./test.py $1 -f insert/smallint.py +python3 ./test.py $1 -f insert/tinyint.py +python3 ./test.py $1 -f import_merge/importBlock1HO.py +python3 ./test.py $1 -f import_merge/importBlock1HPO.py +python3 ./test.py $1 -f import_merge/importBlock1H.py +python3 ./test.py $1 -f import_merge/importBlock1S.py +python3 ./test.py $1 -f import_merge/importBlock1Sub.py +python3 ./test.py $1 -f import_merge/importBlock1TO.py +python3 ./test.py $1 -f import_merge/importBlock1TPO.py +python3 ./test.py $1 -f import_merge/importBlock1T.py +python3 ./test.py $1 -f import_merge/importBlock2HO.py +python3 ./test.py $1 -f import_merge/importBlock2HPO.py +python3 ./test.py $1 -f import_merge/importBlock2H.py +python3 ./test.py $1 -f import_merge/importBlock2S.py +python3 ./test.py $1 -f import_merge/importBlock2Sub.py +python3 ./test.py $1 -f import_merge/importBlock2TO.py +python3 ./test.py $1 -f import_merge/importBlock2TPO.py +python3 ./test.py $1 -f import_merge/importBlock2T.py +python3 ./test.py $1 -f import_merge/importBlockbetween.py +python3 ./test.py $1 -f import_merge/importCacheFileHO.py +python3 ./test.py $1 -f import_merge/importCacheFileHPO.py +python3 ./test.py $1 -f import_merge/importCacheFileH.py +python3 ./test.py $1 -f import_merge/importCacheFileS.py +python3 ./test.py $1 -f import_merge/importCacheFileSub.py +python3 ./test.py $1 -f import_merge/importCacheFileTO.py +python3 ./test.py $1 -f import_merge/importCacheFileTPO.py +python3 ./test.py $1 -f import_merge/importCacheFileT.py +python3 ./test.py $1 -f import_merge/importDataH2.py +python3 ./test.py $1 -f import_merge/importDataHO2.py +python3 ./test.py $1 -f import_merge/importDataHO.py +python3 ./test.py $1 -f import_merge/importDataHPO.py +python3 ./test.py $1 -f import_merge/importDataLastHO.py +python3 ./test.py $1 -f import_merge/importDataLastHPO.py +python3 ./test.py $1 -f import_merge/importDataLastH.py +python3 ./test.py $1 -f import_merge/importDataLastS.py +python3 ./test.py $1 -f import_merge/importDataLastSub.py +python3 ./test.py $1 -f import_merge/importDataLastTO.py +python3 ./test.py $1 -f import_merge/importDataLastTPO.py +python3 ./test.py $1 -f import_merge/importDataLastT.py +python3 ./test.py $1 -f import_merge/importDataS.py +python3 ./test.py $1 -f import_merge/importDataSub.py +python3 ./test.py $1 -f import_merge/importDataTO.py +python3 ./test.py $1 -f import_merge/importDataTPO.py +python3 ./test.py $1 -f import_merge/importDataT.py +python3 ./test.py $1 -f import_merge/importHeadOverlap.py +python3 ./test.py $1 -f import_merge/importHeadPartOverlap.py +python3 ./test.py $1 -f import_merge/importHead.py +python3 ./test.py $1 -f import_merge/importHORestart.py +python3 ./test.py $1 -f import_merge/importHPORestart.py +python3 ./test.py $1 -f import_merge/importHRestart.py +python3 ./test.py $1 -f import_merge/importLastHO.py +python3 ./test.py $1 -f import_merge/importLastHPO.py +python3 ./test.py $1 -f import_merge/importLastH.py +python3 ./test.py $1 -f import_merge/importLastS.py +python3 ./test.py $1 -f import_merge/importLastSub.py +python3 ./test.py $1 -f import_merge/importLastTO.py +python3 ./test.py $1 -f import_merge/importLastTPO.py +python3 ./test.py $1 -f import_merge/importLastT.py +python3 ./test.py $1 -f import_merge/importSpan.py +python3 ./test.py $1 -f import_merge/importSRestart.py +python3 ./test.py $1 -f import_merge/importSubRestart.py +python3 ./test.py $1 -f import_merge/importTailOverlap.py +python3 ./test.py $1 -f import_merge/importTailPartOverlap.py +python3 ./test.py $1 -f import_merge/importTail.py +python3 ./test.py $1 -f import_merge/importToCommit.py +python3 ./test.py $1 -f import_merge/importTORestart.py +python3 ./test.py $1 -f import_merge/importTPORestart.py +python3 ./test.py $1 -f import_merge/importTRestart.py diff --git a/tests/pytest/import_merge/__init__.py b/tests/pytest/import_merge/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/pytest/import_merge/importBlock1H.py b/tests/pytest/import_merge/importBlock1H.py new file mode 100644 index 0000000000..8ef3735826 --- /dev/null +++ b/tests/pytest/import_merge/importBlock1H.py @@ -0,0 +1,70 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,39): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(39) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1HO.py b/tests/pytest/import_merge/importBlock1HO.py new file mode 100644 index 0000000000..e88c13970e --- /dev/null +++ b/tests/pytest/import_merge/importBlock1HO.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,39): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 10 data before with overlap") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(43) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1HPO.py b/tests/pytest/import_merge/importBlock1HPO.py new file mode 100644 index 0000000000..c0cbad5462 --- /dev/null +++ b/tests/pytest/import_merge/importBlock1HPO.py @@ -0,0 +1,75 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + for rid in range(15,43): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 20 data before with partly overlap") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(47) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1S.py b/tests/pytest/import_merge/importBlock1S.py new file mode 100644 index 0000000000..849c1ece8e --- /dev/null +++ b/tests/pytest/import_merge/importBlock1S.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,39): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 50 data covering existing data") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,51): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(50) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1Sub.py b/tests/pytest/import_merge/importBlock1Sub.py new file mode 100644 index 0000000000..ef75c49d09 --- /dev/null +++ b/tests/pytest/import_merge/importBlock1Sub.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,39): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1T.py b/tests/pytest/import_merge/importBlock1T.py new file mode 100644 index 0000000000..ac1fb5a8d9 --- /dev/null +++ b/tests/pytest/import_merge/importBlock1T.py @@ -0,0 +1,70 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,39): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 1 data after") + startTime = self.startTime + 38 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+1, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(39) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1TO.py b/tests/pytest/import_merge/importBlock1TO.py new file mode 100644 index 0000000000..52580de81c --- /dev/null +++ b/tests/pytest/import_merge/importBlock1TO.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,39): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 10 data later with overlap") + startTime = self.startTime + 30 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(40) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1TPO.py b/tests/pytest/import_merge/importBlock1TPO.py new file mode 100644 index 0000000000..f1b6186212 --- /dev/null +++ b/tests/pytest/import_merge/importBlock1TPO.py @@ -0,0 +1,75 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,31): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + for rid in range(35,43): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 30 data later with partly overlap") + startTime = self.startTime + 25 + sqlcmd = ['import into tb1 values'] + for rid in range(1,31): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(55) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2H.py b/tests/pytest/import_merge/importBlock2H.py new file mode 100644 index 0000000000..24a2f1fd08 --- /dev/null +++ b/tests/pytest/import_merge/importBlock2H.py @@ -0,0 +1,70 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,77): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(77) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2HO.py b/tests/pytest/import_merge/importBlock2HO.py new file mode 100644 index 0000000000..37ab498ae8 --- /dev/null +++ b/tests/pytest/import_merge/importBlock2HO.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,77): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 10 data before with overlap") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(81) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2HPO.py b/tests/pytest/import_merge/importBlock2HPO.py new file mode 100644 index 0000000000..6243d2483f --- /dev/null +++ b/tests/pytest/import_merge/importBlock2HPO.py @@ -0,0 +1,75 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + for rid in range(15,81): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 20 data before with partly overlap") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(85) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2S.py b/tests/pytest/import_merge/importBlock2S.py new file mode 100644 index 0000000000..4aa1dfd9dd --- /dev/null +++ b/tests/pytest/import_merge/importBlock2S.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,77): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 90 data covering existing data") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,91): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(90) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2Sub.py b/tests/pytest/import_merge/importBlock2Sub.py new file mode 100644 index 0000000000..fe95b2d34d --- /dev/null +++ b/tests/pytest/import_merge/importBlock2Sub.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,77): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2T.py b/tests/pytest/import_merge/importBlock2T.py new file mode 100644 index 0000000000..4d5a4c942d --- /dev/null +++ b/tests/pytest/import_merge/importBlock2T.py @@ -0,0 +1,70 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,77): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 1 data after") + startTime = self.startTime + 76 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+1, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(77) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2TO.py b/tests/pytest/import_merge/importBlock2TO.py new file mode 100644 index 0000000000..1bfea0a393 --- /dev/null +++ b/tests/pytest/import_merge/importBlock2TO.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,77): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 10 data later with overlap") + startTime = self.startTime + 70 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(80) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2TPO.py b/tests/pytest/import_merge/importBlock2TPO.py new file mode 100644 index 0000000000..b97b4b90b0 --- /dev/null +++ b/tests/pytest/import_merge/importBlock2TPO.py @@ -0,0 +1,75 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,61): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + for rid in range(65,81): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 30 data later with partly overlap") + startTime = self.startTime + 55 + sqlcmd = ['import into tb1 values'] + for rid in range(1,31): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(85) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlockbetween.py b/tests/pytest/import_merge/importBlockbetween.py new file mode 100644 index 0000000000..0dd9ed2bc2 --- /dev/null +++ b/tests/pytest/import_merge/importBlockbetween.py @@ -0,0 +1,76 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") + + tdLog.info("================= step2") + tdLog.info("import 76 sequential data with gap between 2 blocks") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,39): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + for rid in range(40,78): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import data into the gap between 2 blocks") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(39,40): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(77) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileH.py b/tests/pytest/import_merge/importCacheFileH.py new file mode 100644 index 0000000000..66155d7b5f --- /dev/null +++ b/tests/pytest/import_merge/importCacheFileH.py @@ -0,0 +1,86 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(21) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileHO.py b/tests/pytest/import_merge/importCacheFileHO.py new file mode 100644 index 0000000000..e53722f853 --- /dev/null +++ b/tests/pytest/import_merge/importCacheFileHO.py @@ -0,0 +1,89 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 10 data before with overlap") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(25) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileHPO.py b/tests/pytest/import_merge/importCacheFileHPO.py new file mode 100644 index 0000000000..5e869534ba --- /dev/null +++ b/tests/pytest/import_merge/importCacheFileHPO.py @@ -0,0 +1,91 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 9 sequential data with gap") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + if (rid == 5): continue + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(9) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 9 data again with gap") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + if (rid == 5): continue + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(18) + + tdLog.info("================= step7") + tdLog.info("import 20 data before with partly overlap") + startTime = self.startTime - 3 + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(23) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileS.py b/tests/pytest/import_merge/importCacheFileS.py new file mode 100644 index 0000000000..151ce8d9ab --- /dev/null +++ b/tests/pytest/import_merge/importCacheFileS.py @@ -0,0 +1,89 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 30 data covering existing data") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,31): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(30) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileSub.py b/tests/pytest/import_merge/importCacheFileSub.py new file mode 100644 index 0000000000..6237caeec4 --- /dev/null +++ b/tests/pytest/import_merge/importCacheFileSub.py @@ -0,0 +1,89 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileT.py b/tests/pytest/import_merge/importCacheFileT.py new file mode 100644 index 0000000000..70d6fa09ff --- /dev/null +++ b/tests/pytest/import_merge/importCacheFileT.py @@ -0,0 +1,86 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 1 data later") + startTime = self.startTime + 20 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+1, rid)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(21) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileTO.py b/tests/pytest/import_merge/importCacheFileTO.py new file mode 100644 index 0000000000..16ec29bb02 --- /dev/null +++ b/tests/pytest/import_merge/importCacheFileTO.py @@ -0,0 +1,89 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 10 data later with overlap") + startTime = self.startTime + 15 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(25) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileTPO.py b/tests/pytest/import_merge/importCacheFileTPO.py new file mode 100644 index 0000000000..8b61e1ca72 --- /dev/null +++ b/tests/pytest/import_merge/importCacheFileTPO.py @@ -0,0 +1,91 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 9 sequential data with gap") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + if (rid == 7): continue + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(9) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 9 data again with gap") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + if (rid == 7): continue + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(18) + + tdLog.info("================= step7") + tdLog.info("import 20 data later with partly overlap") + startTime = self.startTime + 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(25) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataH2.py b/tests/pytest/import_merge/importDataH2.py new file mode 100644 index 0000000000..0df7d67d88 --- /dev/null +++ b/tests/pytest/import_merge/importDataH2.py @@ -0,0 +1,91 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + + tdLog.info("================= step2") + tdLog.info("import %d sequential data" %(self.rows/2)) + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,self.rows/2+1): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(self.rows/2) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + + + tdLog.info("================= step7") + tdSql.execute('reset query cache') + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(self.rows/2 + 1) + + tdLog.info("================= step8") + tdLog.info("import 10 data in batch before") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime - rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step9") + tdSql.execute('reset query cache') + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(self.rows/2 + 11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataHO.py b/tests/pytest/import_merge/importDataHO.py new file mode 100644 index 0000000000..84dcb82a57 --- /dev/null +++ b/tests/pytest/import_merge/importDataHO.py @@ -0,0 +1,80 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + self.rowsPerTable = 20 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + + tdLog.info("================= step2") + tdLog.info("import %d sequential data" %self.rowsPerTable) + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,self.rowsPerTable+1): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select count(*) from tb1') + tdSql.checkData(0, 0, self.rowsPerTable) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 6 data before with overlap") + startTime = self.startTime - 3 + sqlcmd = ['import into tb1 values'] + for rid in range(1,7): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(self.rowsPerTable + 3) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataHO2.py b/tests/pytest/import_merge/importDataHO2.py new file mode 100644 index 0000000000..8077849cc1 --- /dev/null +++ b/tests/pytest/import_merge/importDataHO2.py @@ -0,0 +1,80 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + self.rowsPerTable = 100 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + + tdLog.info("================= step2") + tdLog.info("import %d sequential data" %self.rowsPerTable) + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,self.rowsPerTable+1): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select count(*) from tb1') + tdSql.checkData(0, 0, self.rowsPerTable) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 6 data before with overlap") + startTime = self.startTime - 3 + sqlcmd = ['import into tb1 values'] + for rid in range(6, 0, -1): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(self.rowsPerTable+3) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataHPO.py b/tests/pytest/import_merge/importDataHPO.py new file mode 100644 index 0000000000..a73ae9c103 --- /dev/null +++ b/tests/pytest/import_merge/importDataHPO.py @@ -0,0 +1,82 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + self.rowsPerTable = 20 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + + tdLog.info("================= step2") + tdLog.info("import %d sequential data" %self.rowsPerTable) + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,10): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + for rid in range(14,self.rowsPerTable+5): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select count(*) from tb1') + tdSql.checkData(0, 0, self.rowsPerTable) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 20 data before with partly overlap") + startTime = self.startTime - 4 + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(self.rowsPerTable+8) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastH.py b/tests/pytest/import_merge/importDataLastH.py new file mode 100644 index 0000000000..c867703e13 --- /dev/null +++ b/tests/pytest/import_merge/importDataLastH.py @@ -0,0 +1,76 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,206): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(206) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastHO.py b/tests/pytest/import_merge/importDataLastHO.py new file mode 100644 index 0000000000..68e858f781 --- /dev/null +++ b/tests/pytest/import_merge/importDataLastHO.py @@ -0,0 +1,79 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,206): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 5 data before with overlap") + startTime = self.startTime - 2 + sqlcmd = ['import into tb1 values'] + for rid in range(1,6): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(207) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastHPO.py b/tests/pytest/import_merge/importDataLastHPO.py new file mode 100644 index 0000000000..29b71a7a8b --- /dev/null +++ b/tests/pytest/import_merge/importDataLastHPO.py @@ -0,0 +1,81 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + for rid in range(14,209): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 20 data before with partly overlap") + startTime = self.startTime - 2 + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(210) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastS.py b/tests/pytest/import_merge/importDataLastS.py new file mode 100644 index 0000000000..cb61f5d088 --- /dev/null +++ b/tests/pytest/import_merge/importDataLastS.py @@ -0,0 +1,79 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,206): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 250 data covering the existing data") + startTime = self.startTime - 15 + sqlcmd = ['import into tb1 values'] + for rid in range(1,251): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(250) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastSub.py b/tests/pytest/import_merge/importDataLastSub.py new file mode 100644 index 0000000000..2b30c7c7c8 --- /dev/null +++ b/tests/pytest/import_merge/importDataLastSub.py @@ -0,0 +1,79 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,206): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastT.py b/tests/pytest/import_merge/importDataLastT.py new file mode 100644 index 0000000000..fecf64e495 --- /dev/null +++ b/tests/pytest/import_merge/importDataLastT.py @@ -0,0 +1,72 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,206): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data later") + startTime = self.startTime + 205 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(206) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastTO.py b/tests/pytest/import_merge/importDataLastTO.py new file mode 100644 index 0000000000..700c2b8f04 --- /dev/null +++ b/tests/pytest/import_merge/importDataLastTO.py @@ -0,0 +1,75 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,206): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 5 data later with overlap") + startTime = self.startTime + 203 + sqlcmd = ['import into tb1 values'] + for rid in range(1,6): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(208) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastTPO.py b/tests/pytest/import_merge/importDataLastTPO.py new file mode 100644 index 0000000000..2ae43378e8 --- /dev/null +++ b/tests/pytest/import_merge/importDataLastTPO.py @@ -0,0 +1,77 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,196): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + for rid in range(200,210): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 20 data later with partly overlap") + startTime = self.startTime + 192 + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(212) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataS.py b/tests/pytest/import_merge/importDataS.py new file mode 100644 index 0000000000..0a1849f5f7 --- /dev/null +++ b/tests/pytest/import_merge/importDataS.py @@ -0,0 +1,75 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + + tdLog.info("================= step2") + tdLog.info("import 20 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 30 data covering the existing data") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1,31): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(30) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataSub.py b/tests/pytest/import_merge/importDataSub.py new file mode 100644 index 0000000000..cd7b37b921 --- /dev/null +++ b/tests/pytest/import_merge/importDataSub.py @@ -0,0 +1,80 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + + tdLog.info("================= step2") + tdLog.info("import %d sequential data" %(self.rows/2)) + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,self.rows/2+1): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(self.rows/2) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1,11): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step9") + tdSql.execute('reset query cache') + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(self.rows/2) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataT.py b/tests/pytest/import_merge/importDataT.py new file mode 100644 index 0000000000..8054d0a13c --- /dev/null +++ b/tests/pytest/import_merge/importDataT.py @@ -0,0 +1,72 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + + tdLog.info("================= step2") + tdLog.info("import 20 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data later") + startTime = self.startTime + 20 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(21) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataTO.py b/tests/pytest/import_merge/importDataTO.py new file mode 100644 index 0000000000..e808c7382d --- /dev/null +++ b/tests/pytest/import_merge/importDataTO.py @@ -0,0 +1,75 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + + tdLog.info("================= step2") + tdLog.info("import 20 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 6 data later with overlap") + startTime = self.startTime + 18 + sqlcmd = ['import into tb1 values'] + for rid in range(1,7): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(24) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataTPO.py b/tests/pytest/import_merge/importDataTPO.py new file mode 100644 index 0000000000..c9d454103d --- /dev/null +++ b/tests/pytest/import_merge/importDataTPO.py @@ -0,0 +1,78 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + + tdLog.info("================= step2") + tdLog.info("import 20 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,18): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + for rid in range(22,25): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + tdLog.sleep(5) + + tdLog.info("================= step5") + tdLog.info("import 20 data later with partly overlap") + startTime = self.startTime + 15 + sqlcmd = ['import into tb1 values'] + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(35) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHORestart.py b/tests/pytest/import_merge/importHORestart.py new file mode 100644 index 0000000000..0d7bfab30a --- /dev/null +++ b/tests/pytest/import_merge/importHORestart.py @@ -0,0 +1,66 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdSql.prepare() + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 5 data before with overlap") + startTime = self.startTime - 2 + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(12) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHPORestart.py b/tests/pytest/import_merge/importHPORestart.py new file mode 100644 index 0000000000..3be6e74a14 --- /dev/null +++ b/tests/pytest/import_merge/importHPORestart.py @@ -0,0 +1,69 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdSql.prepare() + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + + tdLog.info("================= step2") + tdLog.info("import 8 sequential data with gap") + startTime = self.startTime + for rid in range(1,4): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + for rid in range(6,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(8) + + tdLog.info("================= step4") + tdLog.info("import 8 data before with partly overlap") + startTime = self.startTime - 2 + for rid in range(1, 9): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(12) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHRestart.py b/tests/pytest/import_merge/importHRestart.py new file mode 100644 index 0000000000..3b885f7d45 --- /dev/null +++ b/tests/pytest/import_merge/importHRestart.py @@ -0,0 +1,65 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdSql.prepare() + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHead.py b/tests/pytest/import_merge/importHead.py new file mode 100644 index 0000000000..6b34e2247f --- /dev/null +++ b/tests/pytest/import_merge/importHead.py @@ -0,0 +1,68 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHeadOverlap.py b/tests/pytest/import_merge/importHeadOverlap.py new file mode 100644 index 0000000000..ed17615957 --- /dev/null +++ b/tests/pytest/import_merge/importHeadOverlap.py @@ -0,0 +1,63 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdSql.prepare() + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 5 data before with overlap") + startTime = self.startTime - 2 + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + startTime += 1 + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(12) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHeadPartOverlap.py b/tests/pytest/import_merge/importHeadPartOverlap.py new file mode 100644 index 0000000000..a002edcd5a --- /dev/null +++ b/tests/pytest/import_merge/importHeadPartOverlap.py @@ -0,0 +1,67 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdSql.prepare() + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + + tdLog.info("================= step2") + tdLog.info("import 8 sequential data with gap") + startTime = self.startTime + for rid in range(1,4): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + startTime += 1 + startTime += 2 + for rid in range(6,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(8) + + tdLog.info("================= step4") + tdLog.info("import 8 data before with partly overlap") + startTime = self.startTime - 2 + for rid in range(1, 9): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + startTime += 1 + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(12) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastH.py b/tests/pytest/import_merge/importLastH.py new file mode 100644 index 0000000000..d5096845c7 --- /dev/null +++ b/tests/pytest/import_merge/importLastH.py @@ -0,0 +1,72 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") + + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,6): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(6) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastHO.py b/tests/pytest/import_merge/importLastHO.py new file mode 100644 index 0000000000..13bfcaea70 --- /dev/null +++ b/tests/pytest/import_merge/importLastHO.py @@ -0,0 +1,75 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") + + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,6): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 4 data before with overlap") + startTime = self.startTime - 2 + sqlcmd = ['import into tb1 values'] + for rid in range(1,5): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(7) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastHPO.py b/tests/pytest/import_merge/importLastHPO.py new file mode 100644 index 0000000000..73a0a1d935 --- /dev/null +++ b/tests/pytest/import_merge/importLastHPO.py @@ -0,0 +1,77 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") + + tdLog.info("================= step2") + tdLog.info("import 6 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,4): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + for rid in range(6,9): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(6) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 8 data before with partly overlap") + startTime = self.startTime - 2 + sqlcmd = ['import into tb1 values'] + for rid in range(1,9): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastS.py b/tests/pytest/import_merge/importLastS.py new file mode 100644 index 0000000000..16ce3b464c --- /dev/null +++ b/tests/pytest/import_merge/importLastS.py @@ -0,0 +1,74 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") + + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,6): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 20 data covering existing data") + startTime = self.startTime - 10 + for rid in range(1,21): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastSub.py b/tests/pytest/import_merge/importLastSub.py new file mode 100644 index 0000000000..68d1a57f97 --- /dev/null +++ b/tests/pytest/import_merge/importLastSub.py @@ -0,0 +1,75 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") + + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,6): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 3 data totally repetitive") + startTime = self.startTime + 1 + sqlcmd = ['import into tb1 values'] + for rid in range(1,4): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastT.py b/tests/pytest/import_merge/importLastT.py new file mode 100644 index 0000000000..4c33b4dd01 --- /dev/null +++ b/tests/pytest/import_merge/importLastT.py @@ -0,0 +1,76 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") + + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,6): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data later") + startTime = self.startTime + 5 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(6) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastTO.py b/tests/pytest/import_merge/importLastTO.py new file mode 100644 index 0000000000..e89fa342ae --- /dev/null +++ b/tests/pytest/import_merge/importLastTO.py @@ -0,0 +1,79 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") + + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,6): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 4 data later with overlap") + startTime = self.startTime + 3 + sqlcmd = ['import into tb1 values'] + for rid in range(1,5): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(7) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastTPO.py b/tests/pytest/import_merge/importLastTPO.py new file mode 100644 index 0000000000..2b673bf152 --- /dev/null +++ b/tests/pytest/import_merge/importLastTPO.py @@ -0,0 +1,80 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' %self.rows) + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") + + tdLog.info("================= step2") + tdLog.info("import 6 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1,4): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + for rid in range(6,9): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(6) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 8 data later with partly overlap") + startTime = self.startTime + 2 + for rid in range(1,9): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importSRestart.py b/tests/pytest/import_merge/importSRestart.py new file mode 100644 index 0000000000..5636ab5015 --- /dev/null +++ b/tests/pytest/import_merge/importSRestart.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 20 data cover existing data") + startTime = self.startTime - 5 + for rid in range(1,21): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importSpan.py b/tests/pytest/import_merge/importSpan.py new file mode 100644 index 0000000000..e57062a7b5 --- /dev/null +++ b/tests/pytest/import_merge/importSpan.py @@ -0,0 +1,68 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 20 data cover existing data") + startTime = self.startTime - 5 + for rid in range(1,21): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importSubRestart.py b/tests/pytest/import_merge/importSubRestart.py new file mode 100644 index 0000000000..aae79d787b --- /dev/null +++ b/tests/pytest/import_merge/importSubRestart.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + + tdLog.info("================= step2") + tdLog.info("import 20 sequential data") + startTime = self.startTime + for rid in range(1,21): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step4") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + 5 + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTORestart.py b/tests/pytest/import_merge/importTORestart.py new file mode 100644 index 0000000000..6a0621568d --- /dev/null +++ b/tests/pytest/import_merge/importTORestart.py @@ -0,0 +1,73 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 6 data after with overlap") + startTime = self.startTime + 8 + for rid in range(1,7): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(14) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTPORestart.py b/tests/pytest/import_merge/importTPORestart.py new file mode 100644 index 0000000000..0ccb481890 --- /dev/null +++ b/tests/pytest/import_merge/importTPORestart.py @@ -0,0 +1,75 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + + tdLog.info("================= step2") + tdLog.info("import 8 sequential data with gap") + startTime = self.startTime + for rid in range(1,6): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + for rid in range(8,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(8) + + tdLog.info("================= step4") + tdLog.info("import 8 data after with partly overlap") + startTime = self.startTime + 3 + for rid in range(1,9): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTRestart.py b/tests/pytest/import_merge/importTRestart.py new file mode 100644 index 0000000000..a80a3df0c7 --- /dev/null +++ b/tests/pytest/import_merge/importTRestart.py @@ -0,0 +1,72 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 1 data after") + startTime = self.startTime + 11 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTail.py b/tests/pytest/import_merge/importTail.py new file mode 100644 index 0000000000..4cfa248ecb --- /dev/null +++ b/tests/pytest/import_merge/importTail.py @@ -0,0 +1,68 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 1 data after") + startTime += 1 + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTailOverlap.py b/tests/pytest/import_merge/importTailOverlap.py new file mode 100644 index 0000000000..6cbf9d2e14 --- /dev/null +++ b/tests/pytest/import_merge/importTailOverlap.py @@ -0,0 +1,70 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 6 data after with overlap") + startTime = self.startTime + 8 + for rid in range(1,7): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + startTime += 1 + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(14) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTailPartOverlap.py b/tests/pytest/import_merge/importTailPartOverlap.py new file mode 100644 index 0000000000..473b0314d8 --- /dev/null +++ b/tests/pytest/import_merge/importTailPartOverlap.py @@ -0,0 +1,70 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + + tdLog.info("================= step2") + tdLog.info("import 8 sequential data with gap") + startTime = self.startTime + for rid in range(1,6): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + for rid in range(8,11): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(8) + + tdLog.info("================= step4") + tdLog.info("import 8 data after with partly overlap") + startTime = self.startTime + 3 + for rid in range(1,9): + tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importToCommit.py b/tests/pytest/import_merge/importToCommit.py new file mode 100644 index 0000000000..9e14e3cd17 --- /dev/null +++ b/tests/pytest/import_merge/importToCommit.py @@ -0,0 +1,81 @@ +################################################################### + # 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 * +from util.cases import * +from util.sql import * +from util.dnodes import * + +class TDTestCase: + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512 tables 10') + tdSql.execute('use db') + + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + tdLog.info("one block can import 38 records and totally there are 40 blocks") + + tdLog.info("================= step2") + tdLog.info('insert data until the first commit') + dnodesDir = tdDnodes.getDnodesRootDir() + dataDir = dnodesDir + '/dnode1/data/data' + startTime = self.startTime + rid0 = 1 + while (True): + sqlcmd = 'insert into tb1 values(%ld, %d)' %(startTime+rid0*2, rid0) + tdSql.execute(sqlcmd) + rid0 += 1 + vnodes = os.listdir(dataDir) + if (len(vnodes) > 0): + tdLog.info("data is committed, stop inserting") + break + + tdLog.info("================= step5") + tdLog.info("import 1 data before ") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(3,4): + sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.execute('reset query cache') + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(rid0-1+1) + + tdLog.info("================= step7") + tdSql.execute('reset query cache') + tdSql.query('select count(*) from tb1') + tdSql.checkData(0, 0, rid0-1+1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/simpletest.sh b/tests/pytest/simpletest.sh deleted file mode 100755 index 73b25d2056..0000000000 --- a/tests/pytest/simpletest.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -python3 ./test.py $1 -f insert/basic.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f insert/int.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f insert/float.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f insert/bigint.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f insert/bool.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f insert/double.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f insert/smallint.py -python3 ./test.py -s $1 -sleep 1 -python3 ./test.py $1 -f insert/tinyint.py -python3 ./test.py -s $1 -sleep 1 diff --git a/tests/pytest/smoketest.sh b/tests/pytest/smoketest.sh new file mode 100755 index 0000000000..71d19df5c0 --- /dev/null +++ b/tests/pytest/smoketest.sh @@ -0,0 +1,55 @@ +#!/bin/bash +python3 ./test.py $1 -f insert/basic.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f insert/int.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f insert/float.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f insert/bigint.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f insert/bool.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f insert/double.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f insert/smallint.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f insert/tinyint.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importDataLastTO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importDataLastT.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importDataTO.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importDataT.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importHeadOverlap.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importHeadPartOverlap.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importHORestart.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importHPORestart.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importHRestart.py +python3 ./test.py -s $1 +sleep 1 +python3 ./test.py $1 -f import_merge/importLastSub.py +python3 ./test.py -s $1 +sleep 1 diff --git a/tests/test-all.sh b/tests/test-all.sh index 6943dd47a7..907ef4bedd 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -25,7 +25,12 @@ if [ "$totalFailed" -ne "0" ]; then fi cd ../pytest -./simpletest.sh 2>&1 | tee pytest-out.txt + +if [ "$1" == "cron" ]; then + ./fulltest.sh 2>&1 | tee pytest-out.txt +else + ./smoketest.sh 2>&1 | tee pytest-out.txt +fi totalPySuccess=`grep 'successfully executed' pytest-out.txt | wc -l` if [ "$totalPySuccess" -gt "0" ]; then From 2777a2f0c931e1d92bf636591b364fe05a6af878 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 27 Apr 2020 15:23:15 +0800 Subject: [PATCH 2/2] fix python source code for pep8 standard. --- tests/pytest/import_merge/importBlock1H.py | 100 +++++++------ tests/pytest/import_merge/importBlock1HO.py | 106 ++++++------- tests/pytest/import_merge/importBlock1HPO.py | 110 +++++++------- tests/pytest/import_merge/importBlock1S.py | 106 ++++++------- tests/pytest/import_merge/importBlock1Sub.py | 106 ++++++------- tests/pytest/import_merge/importBlock1T.py | 100 +++++++------ tests/pytest/import_merge/importBlock1TO.py | 106 ++++++------- tests/pytest/import_merge/importBlock1TPO.py | 110 +++++++------- tests/pytest/import_merge/importBlock2H.py | 100 +++++++------ tests/pytest/import_merge/importBlock2HO.py | 106 ++++++------- tests/pytest/import_merge/importBlock2HPO.py | 110 +++++++------- tests/pytest/import_merge/importBlock2S.py | 106 ++++++------- tests/pytest/import_merge/importBlock2Sub.py | 106 ++++++------- tests/pytest/import_merge/importBlock2T.py | 100 +++++++------ tests/pytest/import_merge/importBlock2TO.py | 106 ++++++------- tests/pytest/import_merge/importBlock2TPO.py | 110 +++++++------- .../pytest/import_merge/importBlockbetween.py | 112 +++++++------- tests/pytest/import_merge/importCacheFileH.py | 126 ++++++++-------- .../pytest/import_merge/importCacheFileHO.py | 132 ++++++++-------- .../pytest/import_merge/importCacheFileHPO.py | 138 ++++++++--------- tests/pytest/import_merge/importCacheFileS.py | 132 ++++++++-------- .../pytest/import_merge/importCacheFileSub.py | 132 ++++++++-------- tests/pytest/import_merge/importCacheFileT.py | 126 ++++++++-------- .../pytest/import_merge/importCacheFileTO.py | 132 ++++++++-------- .../pytest/import_merge/importCacheFileTPO.py | 138 ++++++++--------- tests/pytest/import_merge/importDataH2.py | 141 +++++++++--------- tests/pytest/import_merge/importDataHO.py | 120 ++++++++------- tests/pytest/import_merge/importDataHO2.py | 120 ++++++++------- tests/pytest/import_merge/importDataHPO.py | 124 +++++++-------- tests/pytest/import_merge/importDataLastH.py | 112 +++++++------- tests/pytest/import_merge/importDataLastHO.py | 118 ++++++++------- .../pytest/import_merge/importDataLastHPO.py | 122 +++++++-------- tests/pytest/import_merge/importDataLastS.py | 118 ++++++++------- .../pytest/import_merge/importDataLastSub.py | 118 ++++++++------- tests/pytest/import_merge/importDataLastT.py | 106 ++++++------- tests/pytest/import_merge/importDataLastTO.py | 112 +++++++------- .../pytest/import_merge/importDataLastTPO.py | 116 +++++++------- tests/pytest/import_merge/importDataS.py | 112 +++++++------- tests/pytest/import_merge/importDataSub.py | 120 ++++++++------- tests/pytest/import_merge/importDataT.py | 106 ++++++------- tests/pytest/import_merge/importDataTO.py | 112 +++++++------- tests/pytest/import_merge/importDataTPO.py | 118 ++++++++------- tests/pytest/import_merge/importHORestart.py | 96 ++++++------ tests/pytest/import_merge/importHPORestart.py | 104 +++++++------ tests/pytest/import_merge/importHRestart.py | 92 ++++++------ tests/pytest/import_merge/importHead.py | 96 ++++++------ .../pytest/import_merge/importHeadOverlap.py | 88 +++++------ .../import_merge/importHeadPartOverlap.py | 96 ++++++------ tests/pytest/import_merge/importLastH.py | 104 ++++++------- tests/pytest/import_merge/importLastHO.py | 110 +++++++------- tests/pytest/import_merge/importLastHPO.py | 114 +++++++------- tests/pytest/import_merge/importLastS.py | 108 +++++++------- tests/pytest/import_merge/importLastSub.py | 110 +++++++------- tests/pytest/import_merge/importLastT.py | 110 +++++++------- tests/pytest/import_merge/importLastTO.py | 116 +++++++------- tests/pytest/import_merge/importLastTPO.py | 118 ++++++++------- tests/pytest/import_merge/importSRestart.py | 108 +++++++------- tests/pytest/import_merge/importSpan.py | 100 +++++++------ tests/pytest/import_merge/importSubRestart.py | 108 +++++++------- tests/pytest/import_merge/importTORestart.py | 108 +++++++------- tests/pytest/import_merge/importTPORestart.py | 112 +++++++------- tests/pytest/import_merge/importTRestart.py | 104 ++++++------- tests/pytest/import_merge/importTail.py | 96 ++++++------ .../pytest/import_merge/importTailOverlap.py | 100 +++++++------ .../import_merge/importTailPartOverlap.py | 104 +++++++------ tests/pytest/import_merge/importToCommit.py | 126 ++++++++-------- tests/pytest/query/tbname.py | 15 +- tests/pytest/util/sql.py | 4 +- 68 files changed, 3808 insertions(+), 3590 deletions(-) diff --git a/tests/pytest/import_merge/importBlock1H.py b/tests/pytest/import_merge/importBlock1H.py index 8ef3735826..a1ba905b17 100644 --- a/tests/pytest/import_merge/importBlock1H.py +++ b/tests/pytest/import_merge/importBlock1H.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,53 +18,55 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 38 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,39): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(38) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 1 data before") - startTime = self.startTime - 1 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 39): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(39) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(39) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1HO.py b/tests/pytest/import_merge/importBlock1HO.py index e88c13970e..73aec07a90 100644 --- a/tests/pytest/import_merge/importBlock1HO.py +++ b/tests/pytest/import_merge/importBlock1HO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,58 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 38 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,39): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(38) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 10 data before with overlap") - startTime = self.startTime - 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 39): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 10 data before with overlap") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(43) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(43) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1HPO.py b/tests/pytest/import_merge/importBlock1HPO.py index c0cbad5462..ad224e5c65 100644 --- a/tests/pytest/import_merge/importBlock1HPO.py +++ b/tests/pytest/import_merge/importBlock1HPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,58 +18,60 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 38 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - for rid in range(15,43): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(38) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 20 data before with partly overlap") - startTime = self.startTime - 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + for rid in range(15, 43): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 20 data before with partly overlap") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(47) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(47) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1S.py b/tests/pytest/import_merge/importBlock1S.py index 849c1ece8e..37c2ad6631 100644 --- a/tests/pytest/import_merge/importBlock1S.py +++ b/tests/pytest/import_merge/importBlock1S.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,58 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 38 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,39): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(38) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 50 data covering existing data") - startTime = self.startTime - 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,51): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 39): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 50 data covering existing data") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 51): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(50) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(50) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1Sub.py b/tests/pytest/import_merge/importBlock1Sub.py index ef75c49d09..5228563651 100644 --- a/tests/pytest/import_merge/importBlock1Sub.py +++ b/tests/pytest/import_merge/importBlock1Sub.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,58 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 38 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,39): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(38) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 10 data totally repetitive") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 39): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(38) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1T.py b/tests/pytest/import_merge/importBlock1T.py index ac1fb5a8d9..75f41b98cf 100644 --- a/tests/pytest/import_merge/importBlock1T.py +++ b/tests/pytest/import_merge/importBlock1T.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,53 +18,55 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 38 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,39): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(38) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 1 data after") - startTime = self.startTime + 38 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+1, rid)) + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 39): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 1 data after") + startTime = self.startTime + 38 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime + 1, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(39) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(39) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1TO.py b/tests/pytest/import_merge/importBlock1TO.py index 52580de81c..b43428da27 100644 --- a/tests/pytest/import_merge/importBlock1TO.py +++ b/tests/pytest/import_merge/importBlock1TO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,58 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 38 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,39): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(38) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 10 data later with overlap") - startTime = self.startTime + 30 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 39): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 10 data later with overlap") + startTime = self.startTime + 30 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(40) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(40) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock1TPO.py b/tests/pytest/import_merge/importBlock1TPO.py index f1b6186212..913ca1cc02 100644 --- a/tests/pytest/import_merge/importBlock1TPO.py +++ b/tests/pytest/import_merge/importBlock1TPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,58 +18,60 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 38 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,31): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - for rid in range(35,43): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(38) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 30 data later with partly overlap") - startTime = self.startTime + 25 - sqlcmd = ['import into tb1 values'] - for rid in range(1,31): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 38 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 31): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + for rid in range(35, 43): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(38) + + tdLog.info("================= step4") + tdLog.info("import 30 data later with partly overlap") + startTime = self.startTime + 25 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 31): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(55) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(55) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2H.py b/tests/pytest/import_merge/importBlock2H.py index 24a2f1fd08..bacd88cbe7 100644 --- a/tests/pytest/import_merge/importBlock2H.py +++ b/tests/pytest/import_merge/importBlock2H.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,53 +18,55 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 76 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,77): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(76) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 1 data before") - startTime = self.startTime - 1 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 77): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(77) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(77) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2HO.py b/tests/pytest/import_merge/importBlock2HO.py index 37ab498ae8..01c0f622b6 100644 --- a/tests/pytest/import_merge/importBlock2HO.py +++ b/tests/pytest/import_merge/importBlock2HO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,58 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 76 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,77): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(76) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 10 data before with overlap") - startTime = self.startTime - 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 77): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 10 data before with overlap") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(81) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(81) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2HPO.py b/tests/pytest/import_merge/importBlock2HPO.py index 6243d2483f..ee8d580dfe 100644 --- a/tests/pytest/import_merge/importBlock2HPO.py +++ b/tests/pytest/import_merge/importBlock2HPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,58 +18,60 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 76 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - for rid in range(15,81): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(76) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 20 data before with partly overlap") - startTime = self.startTime - 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + for rid in range(15, 81): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 20 data before with partly overlap") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(85) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(85) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2S.py b/tests/pytest/import_merge/importBlock2S.py index 4aa1dfd9dd..d85074bfeb 100644 --- a/tests/pytest/import_merge/importBlock2S.py +++ b/tests/pytest/import_merge/importBlock2S.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,58 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 76 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,77): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(76) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 90 data covering existing data") - startTime = self.startTime - 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,91): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 77): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 90 data covering existing data") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 91): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(90) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(90) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2Sub.py b/tests/pytest/import_merge/importBlock2Sub.py index fe95b2d34d..deb1dc8337 100644 --- a/tests/pytest/import_merge/importBlock2Sub.py +++ b/tests/pytest/import_merge/importBlock2Sub.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,58 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 76 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,77): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(76) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 10 data totally repetitive") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 77): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(76) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2T.py b/tests/pytest/import_merge/importBlock2T.py index 4d5a4c942d..ded698d28c 100644 --- a/tests/pytest/import_merge/importBlock2T.py +++ b/tests/pytest/import_merge/importBlock2T.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,53 +18,55 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 76 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,77): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(76) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 1 data after") - startTime = self.startTime + 76 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+1, rid)) + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 77): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 1 data after") + startTime = self.startTime + 76 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime + 1, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(77) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(77) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2TO.py b/tests/pytest/import_merge/importBlock2TO.py index 1bfea0a393..ffc88c2c99 100644 --- a/tests/pytest/import_merge/importBlock2TO.py +++ b/tests/pytest/import_merge/importBlock2TO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,58 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 76 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,77): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(76) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 10 data later with overlap") - startTime = self.startTime + 70 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 77): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 10 data later with overlap") + startTime = self.startTime + 70 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(80) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(80) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlock2TPO.py b/tests/pytest/import_merge/importBlock2TPO.py index b97b4b90b0..8b6c70c32b 100644 --- a/tests/pytest/import_merge/importBlock2TPO.py +++ b/tests/pytest/import_merge/importBlock2TPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,58 +18,60 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 76 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,61): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - for rid in range(65,81): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(76) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import 30 data later with partly overlap") - startTime = self.startTime + 55 - sqlcmd = ['import into tb1 values'] - for rid in range(1,31): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 76 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 61): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + for rid in range(65, 81): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import 30 data later with partly overlap") + startTime = self.startTime + 55 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 31): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(85) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(85) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importBlockbetween.py b/tests/pytest/import_merge/importBlockbetween.py index 0dd9ed2bc2..c3482b3776 100644 --- a/tests/pytest/import_merge/importBlockbetween.py +++ b/tests/pytest/import_merge/importBlockbetween.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,59 +18,61 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("one block can import 38 records") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 76 sequential data with gap between 2 blocks") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,39): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - for rid in range(40,78): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(76) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("one block can import 38 records") - tdLog.info("================= step4") - tdLog.info("import data into the gap between 2 blocks") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(39,40): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step2") + tdLog.info("import 76 sequential data with gap between 2 blocks") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 39): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + for rid in range(40, 78): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(76) + + tdLog.info("================= step4") + tdLog.info("import data into the gap between 2 blocks") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(39, 40): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(77) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(77) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileH.py b/tests/pytest/import_merge/importCacheFileH.py index 66155d7b5f..cd2b3a73f1 100644 --- a/tests/pytest/import_merge/importCacheFileH.py +++ b/tests/pytest/import_merge/importCacheFileH.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,69 +18,71 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 10 data again") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) - tdLog.info("================= step7") - tdLog.info("import 1 data before") - startTime = self.startTime - 1 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(21) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step8") - tdSql.query('select * from tb1') - tdSql.checkRows(21) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileHO.py b/tests/pytest/import_merge/importCacheFileHO.py index e53722f853..2e65c337b7 100644 --- a/tests/pytest/import_merge/importCacheFileHO.py +++ b/tests/pytest/import_merge/importCacheFileHO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,72 +18,74 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 10 data again") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) - tdLog.info("================= step7") - tdLog.info("import 10 data before with overlap") - startTime = self.startTime - 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 10 data before with overlap") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(25) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step8") - tdSql.query('select * from tb1') - tdSql.checkRows(25) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileHPO.py b/tests/pytest/import_merge/importCacheFileHPO.py index 5e869534ba..f01ebd0d60 100644 --- a/tests/pytest/import_merge/importCacheFileHPO.py +++ b/tests/pytest/import_merge/importCacheFileHPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,74 +18,78 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 9 sequential data with gap") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - if (rid == 5): continue - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(9) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 9 sequential data with gap") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + if (rid == 5): + continue + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 9 data again with gap") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - if (rid == 5): continue - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(9) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(18) + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) - tdLog.info("================= step7") - tdLog.info("import 20 data before with partly overlap") - startTime = self.startTime - 3 - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step5") + tdLog.info("import 9 data again with gap") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + if (rid == 5): + continue + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(18) + + tdLog.info("================= step7") + tdLog.info("import 20 data before with partly overlap") + startTime = self.startTime - 3 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(23) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step8") - tdSql.query('select * from tb1') - tdSql.checkRows(23) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileS.py b/tests/pytest/import_merge/importCacheFileS.py index 151ce8d9ab..0bb9107562 100644 --- a/tests/pytest/import_merge/importCacheFileS.py +++ b/tests/pytest/import_merge/importCacheFileS.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,72 +18,74 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 10 data again") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) - tdLog.info("================= step7") - tdLog.info("import 30 data covering existing data") - startTime = self.startTime - 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,31): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 30 data covering existing data") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 31): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(30) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step8") - tdSql.query('select * from tb1') - tdSql.checkRows(30) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileSub.py b/tests/pytest/import_merge/importCacheFileSub.py index 6237caeec4..cd5d250968 100644 --- a/tests/pytest/import_merge/importCacheFileSub.py +++ b/tests/pytest/import_merge/importCacheFileSub.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,72 +18,74 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 10 data again") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) - tdLog.info("================= step7") - tdLog.info("import 10 data totally repetitive") - startTime = self.startTime + 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step8") - tdSql.query('select * from tb1') - tdSql.checkRows(20) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileT.py b/tests/pytest/import_merge/importCacheFileT.py index 70d6fa09ff..be79e26bc7 100644 --- a/tests/pytest/import_merge/importCacheFileT.py +++ b/tests/pytest/import_merge/importCacheFileT.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,69 +18,71 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 10 data again") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) - tdLog.info("================= step7") - tdLog.info("import 1 data later") - startTime = self.startTime + 20 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+1, rid)) + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 1 data later") + startTime = self.startTime + 20 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime + 1, rid)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(21) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step8") - tdSql.query('select * from tb1') - tdSql.checkRows(21) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileTO.py b/tests/pytest/import_merge/importCacheFileTO.py index 16ec29bb02..dd17de3adf 100644 --- a/tests/pytest/import_merge/importCacheFileTO.py +++ b/tests/pytest/import_merge/importCacheFileTO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,72 +18,74 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 10 data again") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) - tdLog.info("================= step7") - tdLog.info("import 10 data later with overlap") - startTime = self.startTime + 15 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step5") + tdLog.info("import 10 data again") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step7") + tdLog.info("import 10 data later with overlap") + startTime = self.startTime + 15 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(25) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step8") - tdSql.query('select * from tb1') - tdSql.checkRows(25) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importCacheFileTPO.py b/tests/pytest/import_merge/importCacheFileTPO.py index 8b61e1ca72..948b99ed21 100644 --- a/tests/pytest/import_merge/importCacheFileTPO.py +++ b/tests/pytest/import_merge/importCacheFileTPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,74 +18,78 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 9 sequential data with gap") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - if (rid == 7): continue - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(9) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 9 sequential data with gap") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + if (rid == 7): + continue + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 9 data again with gap") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - if (rid == 7): continue - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(9) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(18) + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) - tdLog.info("================= step7") - tdLog.info("import 20 data later with partly overlap") - startTime = self.startTime + 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step5") + tdLog.info("import 9 data again with gap") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + if (rid == 7): + continue + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(18) + + tdLog.info("================= step7") + tdLog.info("import 20 data later with partly overlap") + startTime = self.startTime + 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step8") + tdSql.query('select * from tb1') + tdSql.checkRows(25) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step8") - tdSql.query('select * from tb1') - tdSql.checkRows(25) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataH2.py b/tests/pytest/import_merge/importDataH2.py index 0df7d67d88..d49abff374 100644 --- a/tests/pytest/import_merge/importDataH2.py +++ b/tests/pytest/import_merge/importDataH2.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,74 +18,77 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import %d sequential data" %(self.rows/2)) - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,self.rows/2+1): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(self.rows/2) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than 10 rows less than %d rows will go to data file" % + self.rows) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import %d sequential data" % (self.rows / 2)) + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, self.rows / 2 + 1): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 1 data before") - startTime = self.startTime - 1 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(self.rows / 2) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime + 1, 1)) + + tdLog.info("================= step7") + tdSql.execute('reset query cache') + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(self.rows / 2 + 1) + + tdLog.info("================= step8") + tdLog.info("import 10 data in batch before") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime - rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step9") + tdSql.execute('reset query cache') + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(self.rows / 2 + 11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step7") - tdSql.execute('reset query cache') - tdSql.query('select * from tb1 order by ts desc') - tdSql.checkRows(self.rows/2 + 1) - - tdLog.info("================= step8") - tdLog.info("import 10 data in batch before") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime - rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step9") - tdSql.execute('reset query cache') - tdSql.query('select * from tb1 order by ts desc') - tdSql.checkRows(self.rows/2 + 11) - - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataHO.py b/tests/pytest/import_merge/importDataHO.py index 84dcb82a57..0483e6844c 100644 --- a/tests/pytest/import_merge/importDataHO.py +++ b/tests/pytest/import_merge/importDataHO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,63 +18,67 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 - self.rowsPerTable = 20 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + self.rowsPerTable = 20 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import %d sequential data" %self.rowsPerTable) - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,self.rowsPerTable+1): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select count(*) from tb1') - tdSql.checkData(0, 0, self.rowsPerTable) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than 10 rows less than %d rows will go to data file" % + self.rows) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import %d sequential data" % self.rowsPerTable) + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, self.rowsPerTable + 1): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 6 data before with overlap") - startTime = self.startTime - 3 - sqlcmd = ['import into tb1 values'] - for rid in range(1,7): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select count(*) from tb1') + tdSql.checkData(0, 0, self.rowsPerTable) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 6 data before with overlap") + startTime = self.startTime - 3 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 7): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(self.rowsPerTable + 3) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1 order by ts desc') - tdSql.checkRows(self.rowsPerTable + 3) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataHO2.py b/tests/pytest/import_merge/importDataHO2.py index 8077849cc1..ab7044d2a7 100644 --- a/tests/pytest/import_merge/importDataHO2.py +++ b/tests/pytest/import_merge/importDataHO2.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,63 +18,67 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 - self.rowsPerTable = 100 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + self.rowsPerTable = 100 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import %d sequential data" %self.rowsPerTable) - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,self.rowsPerTable+1): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select count(*) from tb1') - tdSql.checkData(0, 0, self.rowsPerTable) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than 10 rows less than %d rows will go to data file" % + self.rows) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import %d sequential data" % self.rowsPerTable) + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, self.rowsPerTable + 1): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 6 data before with overlap") - startTime = self.startTime - 3 - sqlcmd = ['import into tb1 values'] - for rid in range(6, 0, -1): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select count(*) from tb1') + tdSql.checkData(0, 0, self.rowsPerTable) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 6 data before with overlap") + startTime = self.startTime - 3 + sqlcmd = ['import into tb1 values'] + for rid in range(6, 0, -1): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(self.rowsPerTable + 3) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1 order by ts desc') - tdSql.checkRows(self.rowsPerTable+3) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataHPO.py b/tests/pytest/import_merge/importDataHPO.py index a73ae9c103..f165bd7b5a 100644 --- a/tests/pytest/import_merge/importDataHPO.py +++ b/tests/pytest/import_merge/importDataHPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,65 +18,69 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 - self.rowsPerTable = 20 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 + self.rowsPerTable = 20 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import %d sequential data" %self.rowsPerTable) - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,10): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - for rid in range(14,self.rowsPerTable+5): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select count(*) from tb1') - tdSql.checkData(0, 0, self.rowsPerTable) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than 10 rows less than %d rows will go to data file" % + self.rows) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import %d sequential data" % self.rowsPerTable) + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 10): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + for rid in range(14, self.rowsPerTable + 5): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 20 data before with partly overlap") - startTime = self.startTime - 4 - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select count(*) from tb1') + tdSql.checkData(0, 0, self.rowsPerTable) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 20 data before with partly overlap") + startTime = self.startTime - 4 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(self.rowsPerTable + 8) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(self.rowsPerTable+8) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastH.py b/tests/pytest/import_merge/importDataLastH.py index c867703e13..319fd40677 100644 --- a/tests/pytest/import_merge/importDataLastH.py +++ b/tests/pytest/import_merge/importDataLastH.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,59 +18,63 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 205 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,206): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(205) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than %d rows less than %d rows will go to data and last file" % + (self.rows, 10 + self.rows)) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 206): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 1 data before") - startTime = self.startTime - 1 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime + 1, 1)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(206) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(206) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastHO.py b/tests/pytest/import_merge/importDataLastHO.py index 68e858f781..5a71c5db65 100644 --- a/tests/pytest/import_merge/importDataLastHO.py +++ b/tests/pytest/import_merge/importDataLastHO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,62 +18,66 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 205 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,206): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(205) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than %d rows less than %d rows will go to data and last file" % + (self.rows, 10 + self.rows)) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 206): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 5 data before with overlap") - startTime = self.startTime - 2 - sqlcmd = ['import into tb1 values'] - for rid in range(1,6): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 5 data before with overlap") + startTime = self.startTime - 2 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 6): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(207) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(207) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastHPO.py b/tests/pytest/import_merge/importDataLastHPO.py index 29b71a7a8b..f2c95cbd4d 100644 --- a/tests/pytest/import_merge/importDataLastHPO.py +++ b/tests/pytest/import_merge/importDataLastHPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,64 +18,68 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 205 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - for rid in range(14,209): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(205) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than %d rows less than %d rows will go to data and last file" % + (self.rows, 10 + self.rows)) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + for rid in range(14, 209): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 20 data before with partly overlap") - startTime = self.startTime - 2 - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 20 data before with partly overlap") + startTime = self.startTime - 2 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(210) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(210) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastS.py b/tests/pytest/import_merge/importDataLastS.py index cb61f5d088..929e02dd1e 100644 --- a/tests/pytest/import_merge/importDataLastS.py +++ b/tests/pytest/import_merge/importDataLastS.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,62 +18,66 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 205 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,206): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(205) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than %d rows less than %d rows will go to data and last file" % + (self.rows, 10 + self.rows)) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 206): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 250 data covering the existing data") - startTime = self.startTime - 15 - sqlcmd = ['import into tb1 values'] - for rid in range(1,251): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 250 data covering the existing data") + startTime = self.startTime - 15 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 251): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(250) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(250) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastSub.py b/tests/pytest/import_merge/importDataLastSub.py index 2b30c7c7c8..158fa0fb3c 100644 --- a/tests/pytest/import_merge/importDataLastSub.py +++ b/tests/pytest/import_merge/importDataLastSub.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,62 +18,66 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 205 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,206): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(205) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than %d rows less than %d rows will go to data and last file" % + (self.rows, 10 + self.rows)) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 206): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 10 data totally repetitive") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(205) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastT.py b/tests/pytest/import_merge/importDataLastT.py index fecf64e495..9bc90a8275 100644 --- a/tests/pytest/import_merge/importDataLastT.py +++ b/tests/pytest/import_merge/importDataLastT.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,55 +18,59 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 205 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,206): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(205) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than %d rows less than %d rows will go to data and last file" % + (self.rows, 10 + self.rows)) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 206): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 1 data later") - startTime = self.startTime + 205 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data later") + startTime = self.startTime + 205 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime + 1, 1)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(206) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(206) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastTO.py b/tests/pytest/import_merge/importDataLastTO.py index 700c2b8f04..0c93ac430b 100644 --- a/tests/pytest/import_merge/importDataLastTO.py +++ b/tests/pytest/import_merge/importDataLastTO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,58 +18,62 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 205 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,206): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(205) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than %d rows less than %d rows will go to data and last file" % + (self.rows, 10 + self.rows)) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 206): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 5 data later with overlap") - startTime = self.startTime + 203 - sqlcmd = ['import into tb1 values'] - for rid in range(1,6): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 5 data later with overlap") + startTime = self.startTime + 203 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 6): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(208) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(208) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataLastTPO.py b/tests/pytest/import_merge/importDataLastTPO.py index 2ae43378e8..188e93e0db 100644 --- a/tests/pytest/import_merge/importDataLastTPO.py +++ b/tests/pytest/import_merge/importDataLastTPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,60 +18,64 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than %d rows less than %d rows will go to data and last file" %(self.rows, 10+self.rows)) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 205 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,196): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - for rid in range(200,210): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(205) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than %d rows less than %d rows will go to data and last file" % + (self.rows, 10 + self.rows)) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 205 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 196): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + for rid in range(200, 210): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 20 data later with partly overlap") - startTime = self.startTime + 192 - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(205) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 20 data later with partly overlap") + startTime = self.startTime + 192 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(212) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(212) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataS.py b/tests/pytest/import_merge/importDataS.py index 0a1849f5f7..65d4087c3d 100644 --- a/tests/pytest/import_merge/importDataS.py +++ b/tests/pytest/import_merge/importDataS.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,58 +18,62 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 20 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than 10 rows less than %d rows will go to data file" % + self.rows) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 20 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 30 data covering the existing data") - startTime = self.startTime - 5 - sqlcmd = ['import into tb1 values'] - for rid in range(1,31): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 30 data covering the existing data") + startTime = self.startTime - 5 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 31): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(30) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(30) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataSub.py b/tests/pytest/import_merge/importDataSub.py index cd7b37b921..4bf85f2bdd 100644 --- a/tests/pytest/import_merge/importDataSub.py +++ b/tests/pytest/import_merge/importDataSub.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,63 +18,67 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import %d sequential data" %(self.rows/2)) - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,self.rows/2+1): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(self.rows/2) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than 10 rows less than %d rows will go to data file" % + self.rows) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import %d sequential data" % (self.rows / 2)) + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, self.rows / 2 + 1): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 10 data totally repetitive") - startTime = self.startTime + 10 - sqlcmd = ['import into tb1 values'] - for rid in range(1,11): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(self.rows / 2) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + 10 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 11): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step9") + tdSql.execute('reset query cache') + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(self.rows / 2) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step9") - tdSql.execute('reset query cache') - tdSql.query('select * from tb1 order by ts desc') - tdSql.checkRows(self.rows/2) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataT.py b/tests/pytest/import_merge/importDataT.py index 8054d0a13c..66016c5555 100644 --- a/tests/pytest/import_merge/importDataT.py +++ b/tests/pytest/import_merge/importDataT.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,55 +18,59 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 20 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than 10 rows less than %d rows will go to data file" % + self.rows) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 20 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 1 data later") - startTime = self.startTime + 20 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data later") + startTime = self.startTime + 20 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime + 1, 1)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(21) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(21) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataTO.py b/tests/pytest/import_merge/importDataTO.py index e808c7382d..a3c17b2846 100644 --- a/tests/pytest/import_merge/importDataTO.py +++ b/tests/pytest/import_merge/importDataTO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,58 +18,62 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 20 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than 10 rows less than %d rows will go to data file" % + self.rows) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 20 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 6 data later with overlap") - startTime = self.startTime + 18 - sqlcmd = ['import into tb1 values'] - for rid in range(1,7): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 6 data later with overlap") + startTime = self.startTime + 18 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 7): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(24) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(24) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importDataTPO.py b/tests/pytest/import_merge/importDataTPO.py index c9d454103d..20eb41cc08 100644 --- a/tests/pytest/import_merge/importDataTPO.py +++ b/tests/pytest/import_merge/importDataTPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,61 +18,65 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("More than 10 rows less than %d rows will go to data file" %self.rows) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 20 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,18): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - for rid in range(22,25): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info( + "More than 10 rows less than %d rows will go to data file" % + self.rows) - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) - tdLog.sleep(5) + tdLog.info("================= step2") + tdLog.info("import 20 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 18): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + for rid in range(22, 25): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 20 data later with partly overlap") - startTime = self.startTime + 15 - sqlcmd = ['import into tb1 values'] - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + tdLog.sleep(5) + + tdLog.info("================= step5") + tdLog.info("import 20 data later with partly overlap") + startTime = self.startTime + 15 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(35) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(35) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHORestart.py b/tests/pytest/import_merge/importHORestart.py index 0d7bfab30a..cfbfa61c90 100644 --- a/tests/pytest/import_merge/importHORestart.py +++ b/tests/pytest/import_merge/importHORestart.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,49 +18,55 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.prepare() + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, i int)') + tdSql.prepare() - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') - tdLog.info("================= step4") - tdLog.info("import 5 data before with overlap") - startTime = self.startTime - 2 - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) - tdLog.info("================= step5") - tdDnodes.forcestop(1) - tdDnodes.start(1) - tdLog.sleep(10) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 5 data before with overlap") + startTime = self.startTime - 2 + for rid in range(1, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(12) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(12) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHPORestart.py b/tests/pytest/import_merge/importHPORestart.py index 3be6e74a14..7e96d44a1a 100644 --- a/tests/pytest/import_merge/importHPORestart.py +++ b/tests/pytest/import_merge/importHPORestart.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,52 +18,60 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.prepare() + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, i int)') + tdSql.prepare() - tdLog.info("================= step2") - tdLog.info("import 8 sequential data with gap") - startTime = self.startTime - for rid in range(1,4): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - for rid in range(6,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - startTime += 1 - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(8) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') - tdLog.info("================= step4") - tdLog.info("import 8 data before with partly overlap") - startTime = self.startTime - 2 - for rid in range(1, 9): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + tdLog.info("================= step2") + tdLog.info("import 8 sequential data with gap") + startTime = self.startTime + for rid in range(1, 4): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + for rid in range(6, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + startTime += 1 - tdLog.info("================= step5") - tdDnodes.forcestop(1) - tdDnodes.start(1) - tdLog.sleep(10) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(8) + + tdLog.info("================= step4") + tdLog.info("import 8 data before with partly overlap") + startTime = self.startTime - 2 + for rid in range(1, 9): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(12) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(12) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHRestart.py b/tests/pytest/import_merge/importHRestart.py index 3b885f7d45..aa1783977e 100644 --- a/tests/pytest/import_merge/importHRestart.py +++ b/tests/pytest/import_merge/importHRestart.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,48 +18,52 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.prepare() + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, i int)') + tdSql.prepare() - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') - tdLog.info("================= step4") - tdLog.info("import 1 data before") - startTime = self.startTime - 1 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) - tdLog.info("================= step5") - tdDnodes.forcestop(1) - tdDnodes.start(1) - tdLog.sleep(10) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(11) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHead.py b/tests/pytest/import_merge/importHead.py index 6b34e2247f..6971986ebc 100644 --- a/tests/pytest/import_merge/importHead.py +++ b/tests/pytest/import_merge/importHead.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,51 +18,53 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) - startTime += 1 - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdLog.info("import 1 data before") - startTime = self.startTime - 1 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1, 11): + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(11) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHeadOverlap.py b/tests/pytest/import_merge/importHeadOverlap.py index ed17615957..df5f07b5a2 100644 --- a/tests/pytest/import_merge/importHeadOverlap.py +++ b/tests/pytest/import_merge/importHeadOverlap.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,46 +18,48 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.prepare() + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.prepare() - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) - startTime += 1 - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdLog.info("import 5 data before with overlap") - startTime = self.startTime - 2 - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) - startTime += 1 + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1, 11): + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 5 data before with overlap") + startTime = self.startTime - 2 + for rid in range(1, 11): + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + startTime += 1 + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(12) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(12) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importHeadPartOverlap.py b/tests/pytest/import_merge/importHeadPartOverlap.py index a002edcd5a..8c9885e22f 100644 --- a/tests/pytest/import_merge/importHeadPartOverlap.py +++ b/tests/pytest/import_merge/importHeadPartOverlap.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,50 +18,52 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.prepare() + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, i int)') + tdSql.prepare() - tdLog.info("================= step2") - tdLog.info("import 8 sequential data with gap") - startTime = self.startTime - for rid in range(1,4): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) - startTime += 1 - startTime += 2 - for rid in range(6,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) - startTime += 1 - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(8) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') - tdLog.info("================= step4") - tdLog.info("import 8 data before with partly overlap") - startTime = self.startTime - 2 - for rid in range(1, 9): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) - startTime += 1 + tdLog.info("================= step2") + tdLog.info("import 8 sequential data with gap") + startTime = self.startTime + for rid in range(1, 4): + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + startTime += 1 + startTime += 2 + for rid in range(6, 11): + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(8) + + tdLog.info("================= step4") + tdLog.info("import 8 data before with partly overlap") + startTime = self.startTime - 2 + for rid in range(1, 9): + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + startTime += 1 + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(12) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(12) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastH.py b/tests/pytest/import_merge/importLastH.py index d5096845c7..c69f453971 100644 --- a/tests/pytest/import_merge/importLastH.py +++ b/tests/pytest/import_merge/importLastH.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,55 +18,57 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("less than 10 rows will go to last file") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 5 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,6): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(5) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 6): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 1 data before") - startTime = self.startTime - 1 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data before") + startTime = self.startTime - 1 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime + 1, 1)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(6) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(6) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastHO.py b/tests/pytest/import_merge/importLastHO.py index 13bfcaea70..ec930d1807 100644 --- a/tests/pytest/import_merge/importLastHO.py +++ b/tests/pytest/import_merge/importLastHO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,58 +18,60 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("less than 10 rows will go to last file") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 5 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,6): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(5) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 6): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 4 data before with overlap") - startTime = self.startTime - 2 - sqlcmd = ['import into tb1 values'] - for rid in range(1,5): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 4 data before with overlap") + startTime = self.startTime - 2 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 5): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(7) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(7) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastHPO.py b/tests/pytest/import_merge/importLastHPO.py index 73a0a1d935..9603a7b852 100644 --- a/tests/pytest/import_merge/importLastHPO.py +++ b/tests/pytest/import_merge/importLastHPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,60 +18,62 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("less than 10 rows will go to last file") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 6 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,4): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - for rid in range(6,9): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(6) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 6 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 4): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + for rid in range(6, 9): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 8 data before with partly overlap") - startTime = self.startTime - 2 - sqlcmd = ['import into tb1 values'] - for rid in range(1,9): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(6) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 8 data before with partly overlap") + startTime = self.startTime - 2 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 9): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(10) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastS.py b/tests/pytest/import_merge/importLastS.py index 16ce3b464c..7dbe74e2ca 100644 --- a/tests/pytest/import_merge/importLastS.py +++ b/tests/pytest/import_merge/importLastS.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,57 +18,59 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("less than 10 rows will go to last file") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 5 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,6): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(5) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 6): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 20 data covering existing data") - startTime = self.startTime - 10 - for rid in range(1,21): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 20 data covering existing data") + startTime = self.startTime - 10 + for rid in range(1, 21): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(20) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastSub.py b/tests/pytest/import_merge/importLastSub.py index 68d1a57f97..f028ba5fd7 100644 --- a/tests/pytest/import_merge/importLastSub.py +++ b/tests/pytest/import_merge/importLastSub.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,58 +18,60 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("less than 10 rows will go to last file") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 5 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,6): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(5) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 6): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 3 data totally repetitive") - startTime = self.startTime + 1 - sqlcmd = ['import into tb1 values'] - for rid in range(1,4): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 3 data totally repetitive") + startTime = self.startTime + 1 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 4): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(5) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastT.py b/tests/pytest/import_merge/importLastT.py index 4c33b4dd01..3fe4e0006c 100644 --- a/tests/pytest/import_merge/importLastT.py +++ b/tests/pytest/import_merge/importLastT.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,59 +18,61 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("less than 10 rows will go to last file") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 5 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,6): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(5) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 6): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 1 data later") - startTime = self.startTime + 5 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime + 1, 1)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 1 data later") + startTime = self.startTime + 5 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime + 1, 1)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(6) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(6) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastTO.py b/tests/pytest/import_merge/importLastTO.py index e89fa342ae..76e5016bdb 100644 --- a/tests/pytest/import_merge/importLastTO.py +++ b/tests/pytest/import_merge/importLastTO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,62 +18,64 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("less than 10 rows will go to last file") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 5 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,6): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(5) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 5 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 6): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 4 data later with overlap") - startTime = self.startTime + 3 - sqlcmd = ['import into tb1 values'] - for rid in range(1,5): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(5) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 4 data later with overlap") + startTime = self.startTime + 3 + sqlcmd = ['import into tb1 values'] + for rid in range(1, 5): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(7) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(7) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importLastTPO.py b/tests/pytest/import_merge/importLastTPO.py index 2b673bf152..08f4168063 100644 --- a/tests/pytest/import_merge/importLastTPO.py +++ b/tests/pytest/import_merge/importLastTPO.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,63 +18,65 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - self.rows = 200 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 + self.rows = 200 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db rows %d' %self.rows) - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("less than 10 rows will go to last file") + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db rows %d' % self.rows) + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 6 sequential data") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(1,4): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - for rid in range(6,9): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(6) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdLog.info("less than 10 rows will go to last file") - tdLog.info("================= step4") - tdDnodes.stop(1) - tdLog.sleep(5) - tdDnodes.start(1) + tdLog.info("================= step2") + tdLog.info("import 6 sequential data") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(1, 4): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + for rid in range(6, 9): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) - tdLog.info("================= step5") - tdLog.info("import 8 data later with partly overlap") - startTime = self.startTime + 2 - for rid in range(1,9): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(6) + + tdLog.info("================= step4") + tdDnodes.stop(1) + tdLog.sleep(5) + tdDnodes.start(1) + + tdLog.info("================= step5") + tdLog.info("import 8 data later with partly overlap") + startTime = self.startTime + 2 + for rid in range(1, 9): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(10) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importSRestart.py b/tests/pytest/import_merge/importSRestart.py index 5636ab5015..0771b8bf9c 100644 --- a/tests/pytest/import_merge/importSRestart.py +++ b/tests/pytest/import_merge/importSRestart.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,62 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, i int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') - tdLog.info("================= step4") - tdLog.info("import 20 data cover existing data") - startTime = self.startTime - 5 - for rid in range(1,21): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) - tdLog.info("================= step5") - tdDnodes.forcestop(1) - tdDnodes.start(1) - tdLog.sleep(10) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 20 data cover existing data") + startTime = self.startTime - 5 + for rid in range(1, 21): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(20) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importSpan.py b/tests/pytest/import_merge/importSpan.py index e57062a7b5..736c4bad64 100644 --- a/tests/pytest/import_merge/importSpan.py +++ b/tests/pytest/import_merge/importSpan.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,51 +18,57 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdLog.info("import 20 data cover existing data") - startTime = self.startTime - 5 - for rid in range(1,21): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 20 data cover existing data") + startTime = self.startTime - 5 + for rid in range(1, 21): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(20) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importSubRestart.py b/tests/pytest/import_merge/importSubRestart.py index aae79d787b..f7f33d32c1 100644 --- a/tests/pytest/import_merge/importSubRestart.py +++ b/tests/pytest/import_merge/importSubRestart.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,62 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, i int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 20 sequential data") - startTime = self.startTime - for rid in range(1,21): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(20) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') - tdLog.info("================= step4") - tdLog.info("import 10 data totally repetitive") - startTime = self.startTime + 5 - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + tdLog.info("================= step2") + tdLog.info("import 20 sequential data") + startTime = self.startTime + for rid in range(1, 21): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) - tdLog.info("================= step5") - tdDnodes.forcestop(1) - tdDnodes.start(1) - tdLog.sleep(10) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + tdLog.info("================= step4") + tdLog.info("import 10 data totally repetitive") + startTime = self.startTime + 5 + for rid in range(1, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(20) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(20) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTORestart.py b/tests/pytest/import_merge/importTORestart.py index 6a0621568d..194756cd12 100644 --- a/tests/pytest/import_merge/importTORestart.py +++ b/tests/pytest/import_merge/importTORestart.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,56 +18,62 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, i int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') - tdLog.info("================= step4") - tdLog.info("import 6 data after with overlap") - startTime = self.startTime + 8 - for rid in range(1,7): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) - tdLog.info("================= step5") - tdDnodes.forcestop(1) - tdDnodes.start(1) - tdLog.sleep(10) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 6 data after with overlap") + startTime = self.startTime + 8 + for rid in range(1, 7): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(14) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(14) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTPORestart.py b/tests/pytest/import_merge/importTPORestart.py index 0ccb481890..36d4b64390 100644 --- a/tests/pytest/import_merge/importTPORestart.py +++ b/tests/pytest/import_merge/importTPORestart.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,58 +18,66 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, i int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 8 sequential data with gap") - startTime = self.startTime - for rid in range(1,6): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - for rid in range(8,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(8) + tdLog.info("================= step2") + tdLog.info("import 8 sequential data with gap") + startTime = self.startTime + for rid in range(1, 6): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + for rid in range(8, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) - tdLog.info("================= step4") - tdLog.info("import 8 data after with partly overlap") - startTime = self.startTime + 3 - for rid in range(1,9): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(8) - tdLog.info("================= step5") - tdDnodes.forcestop(1) - tdDnodes.start(1) - tdLog.sleep(10) + tdLog.info("================= step4") + tdLog.info("import 8 data after with partly overlap") + startTime = self.startTime + 3 + for rid in range(1, 9): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(11) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTRestart.py b/tests/pytest/import_merge/importTRestart.py index a80a3df0c7..9308518d8c 100644 --- a/tests/pytest/import_merge/importTRestart.py +++ b/tests/pytest/import_merge/importTRestart.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,55 +18,59 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, i int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') - tdLog.info("================= step4") - tdLog.info("import 1 data after") - startTime = self.startTime + 11 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) - tdLog.info("================= step5") - tdDnodes.forcestop(1) - tdDnodes.start(1) - tdLog.sleep(10) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 1 data after") + startTime = self.startTime + 11 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step6") - tdSql.query('select * from tb1') - tdSql.checkRows(11) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTail.py b/tests/pytest/import_merge/importTail.py index 4cfa248ecb..a80db730a0 100644 --- a/tests/pytest/import_merge/importTail.py +++ b/tests/pytest/import_merge/importTail.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,51 +18,53 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) - startTime += 1 - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdLog.info("import 1 data after") - startTime += 1 - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1, 11): + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 1 data after") + startTime += 1 + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(11) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTailOverlap.py b/tests/pytest/import_merge/importTailOverlap.py index 6cbf9d2e14..98596d2f77 100644 --- a/tests/pytest/import_merge/importTailOverlap.py +++ b/tests/pytest/import_merge/importTailOverlap.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,53 +18,55 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 10 sequential data") - startTime = self.startTime - for rid in range(1,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) - startTime += 1 - - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(10) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step4") - tdLog.info("import 6 data after with overlap") - startTime = self.startTime + 8 - for rid in range(1,7): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime, rid)) - startTime += 1 + tdLog.info("================= step2") + tdLog.info("import 10 sequential data") + startTime = self.startTime + for rid in range(1, 11): + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + startTime += 1 + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(10) + + tdLog.info("================= step4") + tdLog.info("import 6 data after with overlap") + startTime = self.startTime + 8 + for rid in range(1, 7): + tdSql.execute('import into tb1 values(%ld, %d)' % (startTime, rid)) + startTime += 1 + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(14) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(14) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importTailPartOverlap.py b/tests/pytest/import_merge/importTailPartOverlap.py index 473b0314d8..0263114a25 100644 --- a/tests/pytest/import_merge/importTailPartOverlap.py +++ b/tests/pytest/import_merge/importTailPartOverlap.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,53 +18,61 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db') - tdSql.execute('use db') + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, speed int)') + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') - tdLog.info("================= step2") - tdLog.info("import 8 sequential data with gap") - startTime = self.startTime - for rid in range(1,6): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) - for rid in range(8,11): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, speed int)') - tdLog.info("================= step3") - tdSql.query('select * from tb1') - tdSql.checkRows(8) + tdLog.info("================= step2") + tdLog.info("import 8 sequential data with gap") + startTime = self.startTime + for rid in range(1, 6): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + for rid in range(8, 11): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) - tdLog.info("================= step4") - tdLog.info("import 8 data after with partly overlap") - startTime = self.startTime + 3 - for rid in range(1,9): - tdSql.execute('import into tb1 values(%ld, %d)' %(startTime+rid, rid)) + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(8) + + tdLog.info("================= step4") + tdLog.info("import 8 data after with partly overlap") + startTime = self.startTime + 3 + for rid in range(1, 9): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step5") + tdSql.query('select * from tb1') + tdSql.checkRows(11) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step5") - tdSql.query('select * from tb1') - tdSql.checkRows(11) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/import_merge/importToCommit.py b/tests/pytest/import_merge/importToCommit.py index 9e14e3cd17..7a408bcdce 100644 --- a/tests/pytest/import_merge/importToCommit.py +++ b/tests/pytest/import_merge/importToCommit.py @@ -1,15 +1,15 @@ ################################################################### - # 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 - # +# 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 -*- +# -*- coding: utf-8 -*- import sys import taos @@ -18,64 +18,68 @@ from util.cases import * from util.sql import * from util.dnodes import * + class TDTestCase: - def init(self, conn): - tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor()) - - def run(self): - self.ntables = 1 - self.startTime = 1520000010000 - - tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) - tdSql.execute('reset query cache') - tdSql.execute('drop database if exists db') - tdSql.execute('create database db cache 512 tables 10') - tdSql.execute('use db') + def init(self, conn): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) - tdLog.info("================= step1") - tdLog.info("create 1 table") - tdSql.execute('create table tb1 (ts timestamp, i int)') - tdLog.info("one block can import 38 records and totally there are 40 blocks") + def run(self): + self.ntables = 1 + self.startTime = 1520000010000 - tdLog.info("================= step2") - tdLog.info('insert data until the first commit') - dnodesDir = tdDnodes.getDnodesRootDir() - dataDir = dnodesDir + '/dnode1/data/data' - startTime = self.startTime - rid0 = 1 - while (True): - sqlcmd = 'insert into tb1 values(%ld, %d)' %(startTime+rid0*2, rid0) - tdSql.execute(sqlcmd) - rid0 += 1 - vnodes = os.listdir(dataDir) - if (len(vnodes) > 0): - tdLog.info("data is committed, stop inserting") - break + tdDnodes.stop(1) + tdDnodes.deploy(1) + tdDnodes.start(1) + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db cache 512 tables 10') + tdSql.execute('use db') - tdLog.info("================= step5") - tdLog.info("import 1 data before ") - startTime = self.startTime - sqlcmd = ['import into tb1 values'] - for rid in range(3,4): - sqlcmd.append('(%ld, %d)' %(startTime+rid, rid)) - tdSql.execute(" ".join(sqlcmd)) + tdLog.info("================= step1") + tdLog.info("create 1 table") + tdSql.execute('create table tb1 (ts timestamp, i int)') + tdLog.info( + "one block can import 38 records and totally there are 40 blocks") - tdLog.info("================= step6") - tdSql.execute('reset query cache') - tdSql.query('select * from tb1 order by ts desc') - tdSql.checkRows(rid0-1+1) + tdLog.info("================= step2") + tdLog.info('insert data until the first commit') + dnodesDir = tdDnodes.getDnodesRootDir() + dataDir = dnodesDir + '/dnode1/data/data' + startTime = self.startTime + rid0 = 1 + while (True): + sqlcmd = 'insert into tb1 values(%ld, %d)' % ( + startTime + rid0 * 2, rid0) + tdSql.execute(sqlcmd) + rid0 += 1 + vnodes = os.listdir(dataDir) + if (len(vnodes) > 0): + tdLog.info("data is committed, stop inserting") + break + + tdLog.info("================= step5") + tdLog.info("import 1 data before ") + startTime = self.startTime + sqlcmd = ['import into tb1 values'] + for rid in range(3, 4): + sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) + tdSql.execute(" ".join(sqlcmd)) + + tdLog.info("================= step6") + tdSql.execute('reset query cache') + tdSql.query('select * from tb1 order by ts desc') + tdSql.checkRows(rid0 - 1 + 1) + + tdLog.info("================= step7") + tdSql.execute('reset query cache') + tdSql.query('select count(*) from tb1') + tdSql.checkData(0, 0, rid0 - 1 + 1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) - tdLog.info("================= step7") - tdSql.execute('reset query cache') - tdSql.query('select count(*) from tb1') - tdSql.checkData(0, 0, rid0-1+1) - def stop(self): - tdSql.close() - tdLog.success("%s successfully executed" % __file__) - tdCases.addWindows(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/tbname.py b/tests/pytest/query/tbname.py index d2799efa25..5ea89fff82 100644 --- a/tests/pytest/query/tbname.py +++ b/tests/pytest/query/tbname.py @@ -26,12 +26,14 @@ class TDTestCase: def run(self): tdSql.prepare() - tdSql.execute('create table cars (ts timestamp, speed int) tags(id int)') + tdSql.execute( + 'create table cars (ts timestamp, speed int) tags(id int)') tdSql.execute("create table carzero using cars tags(0)") tdSql.execute("create table carone using cars tags(1)") tdSql.execute("create table cartwo using cars tags(2)") - tdSql.execute("insert into carzero values(now, 100) carone values(now, 110)") + tdSql.execute( + "insert into carzero values(now, 100) carone values(now, 110)") tdSql.query("select * from cars where tbname in ('carzero', 'carone')") tdSql.checkRows(2) @@ -39,13 +41,16 @@ class TDTestCase: tdSql.query("select * from cars where tbname in ('carzero', 'cartwo')") tdSql.checkRows(1) - tdSql.query("select * from cars where id=1 or tbname in ('carzero', 'cartwo')") + tdSql.query( + "select * from cars where id=1 or tbname in ('carzero', 'cartwo')") tdSql.checkRows(2) - tdSql.query("select * from cars where id=1 and tbname in ('carzero', 'cartwo')") + tdSql.query( + "select * from cars where id=1 and tbname in ('carzero', 'cartwo')") tdSql.checkRows(0) - tdSql.query("select * from cars where id=0 and tbname in ('carzero', 'cartwo')") + tdSql.query( + "select * from cars where id=0 and tbname in ('carzero', 'cartwo')") tdSql.checkRows(1) """ diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index edfee4ddb1..15567ec3ca 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -92,10 +92,10 @@ class TDSql: if data is None: tdLog.info("sql:%.40s, row:%d col:%d data:%s == expect:%s" % - (self.sql, row, col, self.queryResult[row][col], data)) + (self.sql, row, col, self.queryResult[row][col], data)) else: tdLog.info("sql:%.40s, row:%d col:%d data:%s == expect:%d" % - (self.sql, row, col, self.queryResult[row][col], data)) + (self.sql, row, col, self.queryResult[row][col], data)) def getData(self, row, col): if row < 0: