From 8f464b418a841bf5fa7e1af6e6270ecbbd6a50ed Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 22 May 2020 14:45:47 +0800 Subject: [PATCH 1/2] add test case to test insert then import scenario. --- .../import_merge/importInsertThenImport.py | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 tests/pytest/import_merge/importInsertThenImport.py diff --git a/tests/pytest/import_merge/importInsertThenImport.py b/tests/pytest/import_merge/importInsertThenImport.py new file mode 100644 index 0000000000..ab640c162c --- /dev/null +++ b/tests/pytest/import_merge/importInsertThenImport.py @@ -0,0 +1,85 @@ +################################################################### +# 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("insert 100 sequential data") + startTime = self.startTime + for rid in range(1, 101): + tdSql.execute( + 'insert into tb1 values(%ld, %d)' % + (startTime + rid, rid)) + + tdLog.info("================= step3") + tdSql.query('select * from tb1') + tdSql.checkRows(100) + + tdLog.info("================= step4") + tdLog.info("import 100 sequential data") + startTime = self.startTime + for rid in range(1, 101): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, 100 + rid)) + + tdSql.query('select * from tb1') + tdSql.checkRows(100) + tdSql.checkData(0, 1, 1) + + tdLog.info("================= step5") + tdDnodes.forcestop(1) + tdDnodes.start(1) + tdLog.sleep(10) + + tdLog.info("================= step6") + tdLog.info("import 100 sequential data again") + startTime = self.startTime + for rid in range(1, 101): + tdSql.execute( + 'import into tb1 values(%ld, %d)' % + (startTime + rid, 100 + rid)) + + tdLog.info("================= step7") + tdSql.query('select * from tb1') + tdSql.checkRows(100) + tdSql.checkData(0, 1, 1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) From 231df632bde806b56a45ff97f688d387b49c45f5 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 22 May 2020 15:42:10 +0800 Subject: [PATCH 2/2] change forcestop() to stop() to emulate ctrl-c --- tests/pytest/fulltest.sh | 235 +++++++++--------- .../import_merge/importInsertThenImport.py | 4 +- tests/pytest/query/filter.py | 2 +- tests/pytest/smoketest.sh | 2 + 4 files changed, 123 insertions(+), 120 deletions(-) diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index 173062fb1f..65820db6e1 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -1,130 +1,131 @@ #!/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 insert/date.py -python3 ./test.py $1 -f insert/binary.py -python3 ./test.py $1 -f insert/nchar.py -python3 ./test.py $1 -f insert/nchar-boundary.py -python3 ./test.py $1 -f insert/nchar-unicode.py -python3 ./test.py $1 -f insert/multi.py +python3 ./test.py -f insert/basic.py +python3 ./test.py -f insert/int.py +python3 ./test.py -f insert/float.py +python3 ./test.py -f insert/bigint.py +python3 ./test.py -f insert/bool.py +python3 ./test.py -f insert/double.py +python3 ./test.py -f insert/smallint.py +python3 ./test.py -f insert/tinyint.py +python3 ./test.py -f insert/date.py +python3 ./test.py -f insert/binary.py +python3 ./test.py -f insert/nchar.py +python3 ./test.py -f insert/nchar-boundary.py +python3 ./test.py -f insert/nchar-unicode.py +python3 ./test.py -f insert/multi.py -python3 ./test.py $1 -f table/column_name.py -python3 ./test.py $1 -f table/column_num.py -python3 ./test.py $1 -f table/db_table.py -python3 ./test.py $1 -f table/tablename-boundary.py +python3 ./test.py -f table/column_name.py +python3 ./test.py -f table/column_num.py +python3 ./test.py -f table/db_table.py +python3 ./test.py -f table/tablename-boundary.py # tag -python3 ./test.py $1 -f tag_lite/filter.py -python3 ./test.py $1 -f tag_lite/create-tags-boundary.py -python3 ./test.py $1 -f tag_lite/3.py -python3 ./test.py $1 -f tag_lite/4.py -python3 ./test.py $1 -f tag_lite/5.py -python3 ./test.py $1 -f tag_lite/6.py -python3 ./test.py $1 -f tag_lite/add.py -python3 ./test.py $1 -f tag_lite/bigint.py -python3 ./test.py $1 -f tag_lite/binary_binary.py -python3 ./test.py $1 -f tag_lite/binary.py -python3 ./test.py $1 -f tag_lite/bool_binary.py -python3 ./test.py $1 -f tag_lite/bool_int.py -python3 ./test.py $1 -f tag_lite/bool.py -python3 ./test.py $1 -f tag_lite/change.py -python3 ./test.py $1 -f tag_lite/column.py -python3 ./test.py $1 -f tag_lite/commit.py -python3 ./test.py $1 -f tag_lite/create.py -python3 ./test.py $1 -f tag_lite/datatype.py -python3 ./test.py $1 -f tag_lite/datatype-without-alter.py -python3 ./test.py $1 -f tag_lite/delete.py -python3 ./test.py $1 -f tag_lite/double.py -python3 ./test.py $1 -f tag_lite/float.py -python3 ./test.py $1 -f tag_lite/int_binary.py -python3 ./test.py $1 -f tag_lite/int_float.py -python3 ./test.py $1 -f tag_lite/int.py -python3 ./test.py $1 -f tag_lite/set.py -python3 ./test.py $1 -f tag_lite/smallint.py -python3 ./test.py $1 -f tag_lite/tinyint.py +python3 ./test.py -f tag_lite/filter.py +python3 ./test.py -f tag_lite/create-tags-boundary.py +python3 ./test.py -f tag_lite/3.py +python3 ./test.py -f tag_lite/4.py +python3 ./test.py -f tag_lite/5.py +python3 ./test.py -f tag_lite/6.py +python3 ./test.py -f tag_lite/add.py +python3 ./test.py -f tag_lite/bigint.py +python3 ./test.py -f tag_lite/binary_binary.py +python3 ./test.py -f tag_lite/binary.py +python3 ./test.py -f tag_lite/bool_binary.py +python3 ./test.py -f tag_lite/bool_int.py +python3 ./test.py -f tag_lite/bool.py +python3 ./test.py -f tag_lite/change.py +python3 ./test.py -f tag_lite/column.py +python3 ./test.py -f tag_lite/commit.py +python3 ./test.py -f tag_lite/create.py +python3 ./test.py -f tag_lite/datatype.py +python3 ./test.py -f tag_lite/datatype-without-alter.py +python3 ./test.py -f tag_lite/delete.py +python3 ./test.py -f tag_lite/double.py +python3 ./test.py -f tag_lite/float.py +python3 ./test.py -f tag_lite/int_binary.py +python3 ./test.py -f tag_lite/int_float.py +python3 ./test.py -f tag_lite/int.py +python3 ./test.py -f tag_lite/set.py +python3 ./test.py -f tag_lite/smallint.py +python3 ./test.py -f tag_lite/tinyint.py -python3 ./test.py $1 -f dbmgmt/database-name-boundary.py +python3 ./test.py -f dbmgmt/database-name-boundary.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 +python3 ./test.py -f import_merge/importBlock1HO.py +python3 ./test.py -f import_merge/importBlock1HPO.py +python3 ./test.py -f import_merge/importBlock1H.py +python3 ./test.py -f import_merge/importBlock1S.py +python3 ./test.py -f import_merge/importBlock1Sub.py +python3 ./test.py -f import_merge/importBlock1TO.py +python3 ./test.py -f import_merge/importBlock1TPO.py +python3 ./test.py -f import_merge/importBlock1T.py +python3 ./test.py -f import_merge/importBlock2HO.py +python3 ./test.py -f import_merge/importBlock2HPO.py +python3 ./test.py -f import_merge/importBlock2H.py +python3 ./test.py -f import_merge/importBlock2S.py +python3 ./test.py -f import_merge/importBlock2Sub.py +python3 ./test.py -f import_merge/importBlock2TO.py +python3 ./test.py -f import_merge/importBlock2TPO.py +python3 ./test.py -f import_merge/importBlock2T.py +python3 ./test.py -f import_merge/importBlockbetween.py +python3 ./test.py -f import_merge/importCacheFileHO.py +python3 ./test.py -f import_merge/importCacheFileHPO.py +python3 ./test.py -f import_merge/importCacheFileH.py +python3 ./test.py -f import_merge/importCacheFileS.py +python3 ./test.py -f import_merge/importCacheFileSub.py +python3 ./test.py -f import_merge/importCacheFileTO.py +python3 ./test.py -f import_merge/importCacheFileTPO.py +python3 ./test.py -f import_merge/importCacheFileT.py +python3 ./test.py -f import_merge/importDataH2.py +python3 ./test.py -f import_merge/importDataHO2.py +python3 ./test.py -f import_merge/importDataHO.py +python3 ./test.py -f import_merge/importDataHPO.py +python3 ./test.py -f import_merge/importDataLastHO.py +python3 ./test.py -f import_merge/importDataLastHPO.py +python3 ./test.py -f import_merge/importDataLastH.py +python3 ./test.py -f import_merge/importDataLastS.py +python3 ./test.py -f import_merge/importDataLastSub.py +python3 ./test.py -f import_merge/importDataLastTO.py +python3 ./test.py -f import_merge/importDataLastTPO.py +python3 ./test.py -f import_merge/importDataLastT.py +python3 ./test.py -f import_merge/importDataS.py +python3 ./test.py -f import_merge/importDataSub.py +python3 ./test.py -f import_merge/importDataTO.py +python3 ./test.py -f import_merge/importDataTPO.py +python3 ./test.py -f import_merge/importDataT.py +python3 ./test.py -f import_merge/importHeadOverlap.py +python3 ./test.py -f import_merge/importHeadPartOverlap.py +python3 ./test.py -f import_merge/importHead.py +python3 ./test.py -f import_merge/importHORestart.py +python3 ./test.py -f import_merge/importHPORestart.py +python3 ./test.py -f import_merge/importHRestart.py +python3 ./test.py -f import_merge/importLastHO.py +python3 ./test.py -f import_merge/importLastHPO.py +python3 ./test.py -f import_merge/importLastH.py +python3 ./test.py -f import_merge/importLastS.py +python3 ./test.py -f import_merge/importLastSub.py +python3 ./test.py -f import_merge/importLastTO.py +python3 ./test.py -f import_merge/importLastTPO.py +python3 ./test.py -f import_merge/importLastT.py +python3 ./test.py -f import_merge/importSpan.py +python3 ./test.py -f import_merge/importSRestart.py +python3 ./test.py -f import_merge/importSubRestart.py +python3 ./test.py -f import_merge/importTailOverlap.py +python3 ./test.py -f import_merge/importTailPartOverlap.py +python3 ./test.py -f import_merge/importTail.py +python3 ./test.py -f import_merge/importToCommit.py +python3 ./test.py -f import_merge/importTORestart.py +python3 ./test.py -f import_merge/importTPORestart.py +python3 ./test.py -f import_merge/importTRestart.py +python3 ./test.py -f import_merge/importInsertThenImport.py # user -python3 ./test.py $1 -f user/user_create.py -python3 ./test.py $1 -f user/pass_len.py +python3 ./test.py -f user/user_create.py +python3 ./test.py -f user/pass_len.py # table -#python3 ./test.py $1 -f table/del_stable.py +#python3 ./test.py -f table/del_stable.py #query -python3 ./test.py $1 -f query/filter.py +python3 ./test.py -f query/filter.py diff --git a/tests/pytest/import_merge/importInsertThenImport.py b/tests/pytest/import_merge/importInsertThenImport.py index ab640c162c..292fae8c47 100644 --- a/tests/pytest/import_merge/importInsertThenImport.py +++ b/tests/pytest/import_merge/importInsertThenImport.py @@ -20,7 +20,7 @@ from util.dnodes import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor()) @@ -59,7 +59,7 @@ class TDTestCase: tdSql.checkData(0, 1, 1) tdLog.info("================= step5") - tdDnodes.forcestop(1) + tdDnodes.stop(1) tdDnodes.start(1) tdLog.sleep(10) diff --git a/tests/pytest/query/filter.py b/tests/pytest/query/filter.py index e58907aa47..43c8e5bf0a 100644 --- a/tests/pytest/query/filter.py +++ b/tests/pytest/query/filter.py @@ -19,7 +19,7 @@ from util.sql import * class TDTestCase: - def init(self, conn): + def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor()) diff --git a/tests/pytest/smoketest.sh b/tests/pytest/smoketest.sh index 16fa38487d..37a68baecf 100755 --- a/tests/pytest/smoketest.sh +++ b/tests/pytest/smoketest.sh @@ -46,6 +46,8 @@ python3 ./test.py $1 -f import_merge/importTail.py python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -f import_merge/importTRestart.py python3 ./test.py $1 -s && sleep 1 +python3 ./test.py $1 -f import_merge/importInsertThenImport.py +python3 ./test.py $1 -s && sleep 1 #tag python3 ./test.py $1 -f tag_lite/filter.py