Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
冷面1992
TDengine
提交
b45fbe08
TDengine
项目概览
冷面1992
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b45fbe08
编写于
7月 07, 2021
作者:
H
Hui Li
提交者:
GitHub
7月 07, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6775 from taosdata/test/TD-5063-m
Test/td 5063 m
上级
ad7a59d7
96e483ea
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
179 addition
and
0 deletion
+179
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/insert/insert_locking.py
tests/pytest/insert/insert_locking.py
+178
-0
未找到文件。
tests/pytest/fulltest.sh
浏览文件 @
b45fbe08
...
...
@@ -328,6 +328,7 @@ python3 ./test.py -f tag_lite/unsignedTinyint.py
python3 ./test.py
-f
functions/function_percentile2.py
python3 ./test.py
-f
insert/boundary2.py
python3 ./test.py
-f
insert/insert_locking.py
python3 ./test.py
-f
alter/alter_debugFlag.py
python3 ./test.py
-f
query/queryBetweenAnd.py
python3 ./test.py
-f
tag_lite/alter_tag.py
...
...
tests/pytest/insert/insert_locking.py
0 → 100644
浏览文件 @
b45fbe08
###################################################################
# 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
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
import
random
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
run
(
self
):
tdSql
.
prepare
()
# test case for https://jira.taosdata.com:18080/browse/TD-5021
tdLog
.
info
(
"
\n\n
----------step1 : drop db and create db----------
\n
"
)
tdSql
.
execute
(
'''drop database if exists db ;'''
)
tdSql
.
execute
(
'''create database db ;'''
)
sql
=
'''show databases;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
1
)
tdLog
.
info
(
"
\n\n
----------step2 : create stable----------
\n
"
)
tdSql
.
execute
(
'''create stable
db.stable_1 (ts timestamp, payload binary(256))
tags(t1 binary(16),t2 int);'''
)
sql
=
'''show db.stables;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
1
)
tdLog
.
info
(
"
\n\n
----------step3 : create table and insert----------
\n
"
)
sql
=
'''insert into db.table1 using db.stable_1 (t1 , t2) tags ("table_1" , 111) ( values (now, ;'''
tdLog
.
info
(
sql
)
tdSql
.
error
(
sql
)
try
:
tdSql
.
execute
(
sql
)
tdLog
.
exit
(
" unexpected token"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"DB error: syntax error near ', ;' (unexpected token)"
)
sql
=
'''insert into db.table1(ts , payload) using db.stable_1 (t1 , t2) tags ("table_1" , 111) ( values (now, ;'''
tdLog
.
info
(
sql
)
tdSql
.
error
(
sql
)
try
:
tdSql
.
execute
(
sql
)
tdLog
.
exit
(
" bind columns again"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"DB error: syntax error near ', ;' (bind columns again)"
)
sql
=
'''insert into db.table1 using db.stable_1 (t1 , t2) tags ("table_1",111) (ts , payload) ( values (now, ;'''
tdLog
.
info
(
sql
)
tdSql
.
error
(
sql
)
try
:
tdSql
.
execute
(
sql
)
tdLog
.
exit
(
" keyword VALUES or FILE required "
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"DB error: invalid SQL: (keyword VALUES or FILE required)"
)
tdSql
.
execute
(
'''insert into db.table1 using db.stable_1 (t1 , t2)
tags ("table_1" , 111) values ( now , 1) '''
)
sql
=
'''select * from db.stable_1;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
1
)
tdSql
.
checkData
(
0
,
2
,
'table_1'
)
tdLog
.
info
(
"
\n\n
----------step4 : create table and insert again----------
\n
"
)
sql
=
'''insert into db.table2 using db.stable_1 (t1) tags ("table_2") ( values (now, ;'''
tdLog
.
info
(
sql
)
tdSql
.
error
(
sql
)
try
:
tdSql
.
execute
(
sql
)
tdLog
.
exit
(
" unexpected token"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"DB error: syntax error near ', ;' (unexpected token)"
)
tdSql
.
execute
(
'''insert into db.table2 using db.stable_1 (t1)
tags ("table_2") values ( now , 2) '''
)
sql
=
'''select * from db.stable_1;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
1
,
1
,
2
)
tdSql
.
checkData
(
1
,
2
,
'table_2'
)
tdLog
.
info
(
"
\n\n
----------step5 : create table and insert without db----------
\n
"
)
tdSql
.
execute
(
'''use db'''
)
sql
=
'''insert into table3 using stable_1 (t1) tags ("table_3") ( values (now, ;'''
tdLog
.
info
(
sql
)
tdSql
.
error
(
sql
)
try
:
tdSql
.
execute
(
sql
)
tdLog
.
exit
(
" unexpected token"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"DB error: syntax error near ', ;' (unexpected token)"
)
tdSql
.
execute
(
'''insert into table3 using stable_1 (t1 , t2)
tags ("table_3" , 333) values ( now , 3) '''
)
sql
=
'''select * from stable_1;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
2
,
1
,
3
)
tdSql
.
checkData
(
2
,
2
,
'table_3'
)
tdLog
.
info
(
"
\n\n
----------step6 : create tables in one sql ----------
\n
"
)
sql
=
'''insert into table4 using stable_1 (t1) tags ("table_4") values (now, 4)
table5 using stable_1 (t1) tags ("table_5") ( values (now, ;'''
tdLog
.
info
(
sql
)
tdSql
.
error
(
sql
)
try
:
tdSql
.
execute
(
sql
)
tdLog
.
exit
(
" unexpected token"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"DB error: syntax error near ', ;' (unexpected token)"
)
tdSql
.
execute
(
'''insert into table4 using stable_1 (t1) tags ("table_4") values (now, 4)
table5 using stable_1 (t1) tags ("table_5") values (now, 5) '''
)
sql
=
'''select * from stable_1;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkData
(
3
,
1
,
4
)
tdSql
.
checkData
(
3
,
2
,
'table_4'
)
tdSql
.
checkData
(
4
,
1
,
5
)
tdSql
.
checkData
(
4
,
2
,
'table_5'
)
sql
=
'''insert into table6 using stable_1 (t1) tags ("table_6") ( values (now,
table7 using stable_1 (t1) tags ("table_7") values (now, 7);'''
tdLog
.
info
(
sql
)
tdSql
.
error
(
sql
)
try
:
tdSql
.
execute
(
sql
)
tdLog
.
exit
(
" invalid SQL"
)
except
Exception
as
e
:
tdLog
.
info
(
repr
(
e
))
tdLog
.
info
(
"invalid SQL"
)
tdSql
.
execute
(
'''insert into table6 using stable_1 (t1 , t2) tags ("table_6" , 666) values (now, 6)
table7 using stable_1 (t1) tags ("table_7") values (now, 7) '''
)
sql
=
'''select * from stable_1;'''
tdSql
.
query
(
sql
)
tdSql
.
checkRows
(
7
)
tdSql
.
checkData
(
5
,
1
,
6
)
tdSql
.
checkData
(
5
,
2
,
'table_6'
)
tdSql
.
checkData
(
6
,
1
,
7
)
tdSql
.
checkData
(
6
,
2
,
'table_7'
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录