From 0694e69dda7a590c3ad804ba8d66a67c10ca4b51 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Fri, 22 Jan 2021 15:16:33 +0800 Subject: [PATCH 1/5] test for mail --- tests/pytest/insert/unsigenedTinyint.py | 106 ++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 tests/pytest/insert/unsigenedTinyint.py diff --git a/tests/pytest/insert/unsigenedTinyint.py b/tests/pytest/insert/unsigenedTinyint.py new file mode 100644 index 0000000000..1c0634b69a --- /dev/null +++ b/tests/pytest/insert/unsigenedTinyint.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- + +import sys +from util.log import * +from util.cases import * +from util.sql import * + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + tdLog.info('=============== step1') + tdLog.info('create table tb (ts timestamp, speed tinyint unsigned)') + tdSql.execute('create table tb (ts timestamp, speed tinyint unsigned)') + tdLog.info("insert into tb values (now, NULL)") + tdSql.execute("insert into tb values (now, NULL)") + tdLog.info('select * from tb order by ts desc') + tdSql.query('select * from tb order by ts desc') + tdLog.info('tdSql.checkRow(1)') + tdSql.checkRows(1) + tdLog.info('tdSql.checkData(0, 1, null)') + tdSql.checkData(0, 1, None) + tdLog.info('=============== step2') + tdLog.info("insert into tb values (now+1m, -1) -x step2") + tdSql.error("insert into tb values (now+1m, -1) ") + tdLog.info("insert into tb values (now+1m, NULL)") + tdSql.execute("insert into tb values (now+1m, NULL)") + tdLog.info('select * from tb order by ts desc') + tdSql.query('select * from tb order by ts desc') + tdLog.info('tdSql.checkRow(2)') + tdSql.checkRows(2) + tdLog.info('tdSql.checkData(0, 1, null)') + tdSql.checkData(0, 1, None) + tdLog.info('=============== step3') + tdLog.info("insert into tb values (now+2m, 254)") + tdSql.execute("insert into tb values (now+2m, 254)") + tdLog.info('select * from tb order by ts desc') + tdSql.query('select * from tb order by ts desc') + tdLog.info('tdSql.checkRow(3)') + tdSql.checkRows(3) + tdLog.info('tdSql.checkData(0, 1, 254)') + tdSql.checkData(0, 1, 254) + tdLog.info('=============== step4') + tdLog.info("insert into tb values (now+3m, 255) -x step4") + tdSql.error("insert into tb values (now+3m, 255)") + tdLog.info("insert into tb values (now+3m, NULL)") + tdSql.execute("insert into tb values (now+3m, NULL)") + tdLog.info('select * from tb') + tdSql.query('select * from tb') + tdLog.info('tdSql.checkRow(4)') + tdSql.checkRows(4) + tdLog.info('tdSql.checkData(0, 1, null)') + tdSql.checkData(0, 1, None) + tdLog.info('=============== step5') + tdLog.info("insert into tb values (now+4m, a2)") + tdSql.error("insert into tb values (now+4m, a2)") + tdLog.info("insert into tb values (now+4m, 0)") + tdSql.execute("insert into tb values (now+4m, 0)") + tdLog.info('select * from tb order by ts desc') + tdSql.query('select * from tb order by ts desc') + tdLog.info('tdSql.checkRow(5)') + tdSql.checkRows(5) + tdLog.info('tdSql.checkData(0, 1, 0)') + tdSql.checkData(0, 1, 0) + tdLog.info('=============== step6') + tdLog.info("insert into tb values (now+5m, 2a)") + tdSql.error("insert into tb values (now+5m, 2a)") + tdLog.info("insert into tb values (now+5m, 2)") + tdSql.execute("insert into tb values (now+5m, 2)") + tdLog.info('select * from tb order by ts desc') + tdSql.query('select * from tb order by ts desc') + tdLog.info('tdSql.checkRow(6)') + tdSql.checkRows(6) + tdLog.info('tdSql.checkData(0, 1, 2)') + tdSql.checkData(0, 1, 2) + tdLog.info('=============== step7') + tdLog.info("insert into tb values (now+6m, 2a'1)") + tdSql.error("insert into tb values (now+6m, 2a'1)") + tdLog.info("insert into tb values (now+6m, 2)") + tdSql.execute("insert into tb values (now+6m, 2)") + tdLog.info('select * from tb order by ts desc') + tdSql.query('select * from tb order by ts desc') + tdLog.info('tdSql.checkRow(7)') + tdSql.checkRows(7) + tdLog.info('tdSql.checkData(0, 1, 2)') + tdSql.checkData(0, 1, 2) + tdLog.info('drop database db') + tdSql.execute('drop database db') + tdLog.info('show databases') + tdSql.query('show databases') + tdLog.info('tdSql.checkRow(0)') + tdSql.checkRows(0) +# convert end + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) From d5a4e0c36876d8287eb3af805c8b21b3571a8d40 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Mon, 25 Jan 2021 13:59:58 +0800 Subject: [PATCH 2/5] [TD-2840]Add email notification for jenkins --- Jenkinsfile | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 73bb832d8e..74cef8f954 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -176,5 +176,83 @@ pipeline { } } } + post { + success { + emailext ( + subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", + body: ''' + + + + + + + + + + + + +

+ 构建信息 +
+
    +
    +
  • 构建名称>>分支:${PROJECT_NAME}
  • +
  • 构建结果: Successful
  • +
  • 构建编号:${BUILD_NUMBER}
  • +
  • 触发用户:${CAUSE}
  • +
  • 提交信息:${CHANGE_TITLE}
  • +
  • 构建地址:${BUILD_URL}
  • +
  • 构建日志:${BUILD_URL}console
  • +
  • 变更集:${JELLY_SCRIPT}
  • +
    +
+
+ + ''', + to: "${CHANGE_AUTHOR_EMAIL}", + from: "support@taosdata.com" + ) + } + failure { + emailext ( + subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", + body: ''' + + + + + + + + + + + + +

+ 构建信息 +
+
    +
    +
  • 构建名称>>分支:${PROJECT_NAME}
  • +
  • 构建结果: Successful
  • +
  • 构建编号:${BUILD_NUMBER}
  • +
  • 触发用户:${CAUSE}
  • +
  • 提交信息:${CHANGE_TITLE}
  • +
  • 构建地址:${BUILD_URL}
  • +
  • 构建日志:${BUILD_URL}console
  • +
  • 变更集:${JELLY_SCRIPT}
  • +
    +
+
+ + ''', + to: "${CHANGE_AUTHOR_EMAIL}", + from: "support@taosdata.com" + ) + } + } } From 7ef5e333b612fac4bb8f5df5c538c6eb259ae148 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Mon, 25 Jan 2021 14:16:44 +0800 Subject: [PATCH 3/5] fix some error --- Jenkinsfile | 4 +-- tests/pytest/tt.py | 27 +++++++++++++++++++ .../general/connection/test_old_data.sim | 6 ++--- 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 tests/pytest/tt.py diff --git a/Jenkinsfile b/Jenkinsfile index 74cef8f954..0f07aeb659 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -211,7 +211,7 @@ pipeline { ''', - to: "${CHANGE_AUTHOR_EMAIL}", + to: "${env.CHANGE_AUTHOR_EMAIL}", from: "support@taosdata.com" ) } @@ -249,7 +249,7 @@ pipeline { ''', - to: "${CHANGE_AUTHOR_EMAIL}", + to: "${env.CHANGE_AUTHOR_EMAIL}", from: "support@taosdata.com" ) } diff --git a/tests/pytest/tt.py b/tests/pytest/tt.py new file mode 100644 index 0000000000..70bc70f581 --- /dev/null +++ b/tests/pytest/tt.py @@ -0,0 +1,27 @@ +import taos +import datetime +import random +# host= '127.0.0.1' +# user = 'root' +# password = 'taosdata' +# conn = taos.connect( +# host, +# user, +# password, +# ) +# cl = conn.cursor() +# cl.execute("select first(_c0),last(_c0) from test.st0 " ) +# dd1=datetime.datetime.now()+ datetime.timedelta(days=5) +# sql = 'select count(*) from test.st0 where ts <= ' + "'" + str(dd1) + "'" +# print(sql) +# cl.execute(sql) +# for data in cl: +# print(data[0]) +# # print(cl[0],cl[1]) +# # d1 = data[0] +# # d2 = data[1] + +# # print(d1+(d2-d1)/2) +# print(random.randrange(-100,100)) +# random.randrange(-100,100) +print(random.getrandbits(1)) \ No newline at end of file diff --git a/tests/script/general/connection/test_old_data.sim b/tests/script/general/connection/test_old_data.sim index 83df850f0b..c7cb1eeb77 100644 --- a/tests/script/general/connection/test_old_data.sim +++ b/tests/script/general/connection/test_old_data.sim @@ -27,6 +27,6 @@ if $rows != 7 then endi -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode2 -s stop -x SIGINT -system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file +# system sh/exec.sh -n dnode1 -s stop -x SIGINT +# system sh/exec.sh -n dnode2 -s stop -x SIGINT +# system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file From 85fbc21f7dfdb07cf49bc8a52e8b49f95a463a96 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Mon, 25 Jan 2021 14:23:55 +0800 Subject: [PATCH 4/5] revert --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0f07aeb659..516b179dce 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -176,7 +176,8 @@ pipeline { } } } - post { + post { + success { emailext ( subject: "PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'", From c906dd5c1e2c3b9340a50fac0610b4d282d565a3 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Mon, 25 Jan 2021 14:26:13 +0800 Subject: [PATCH 5/5] revert --- tests/pytest/tt.py | 27 ------------------- .../general/connection/test_old_data.sim | 6 ++--- 2 files changed, 3 insertions(+), 30 deletions(-) delete mode 100644 tests/pytest/tt.py diff --git a/tests/pytest/tt.py b/tests/pytest/tt.py deleted file mode 100644 index 70bc70f581..0000000000 --- a/tests/pytest/tt.py +++ /dev/null @@ -1,27 +0,0 @@ -import taos -import datetime -import random -# host= '127.0.0.1' -# user = 'root' -# password = 'taosdata' -# conn = taos.connect( -# host, -# user, -# password, -# ) -# cl = conn.cursor() -# cl.execute("select first(_c0),last(_c0) from test.st0 " ) -# dd1=datetime.datetime.now()+ datetime.timedelta(days=5) -# sql = 'select count(*) from test.st0 where ts <= ' + "'" + str(dd1) + "'" -# print(sql) -# cl.execute(sql) -# for data in cl: -# print(data[0]) -# # print(cl[0],cl[1]) -# # d1 = data[0] -# # d2 = data[1] - -# # print(d1+(d2-d1)/2) -# print(random.randrange(-100,100)) -# random.randrange(-100,100) -print(random.getrandbits(1)) \ No newline at end of file diff --git a/tests/script/general/connection/test_old_data.sim b/tests/script/general/connection/test_old_data.sim index c7cb1eeb77..83df850f0b 100644 --- a/tests/script/general/connection/test_old_data.sim +++ b/tests/script/general/connection/test_old_data.sim @@ -27,6 +27,6 @@ if $rows != 7 then endi -# system sh/exec.sh -n dnode1 -s stop -x SIGINT -# system sh/exec.sh -n dnode2 -s stop -x SIGINT -# system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT \ No newline at end of file