Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
efcd12c8
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
efcd12c8
编写于
9月 17, 2020
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-804]<test> add test case for metadata update
上级
36fda719
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
97 addition
and
0 deletion
+97
-0
tests/pytest/client/twoClients.py
tests/pytest/client/twoClients.py
+96
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
未找到文件。
tests/pytest/client/twoClients.py
0 → 100644
浏览文件 @
efcd12c8
###################################################################
# 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
os
import
sys
sys
.
path
.
insert
(
0
,
os
.
getcwd
())
from
util.log
import
*
from
util.sql
import
*
from
util.dnodes
import
*
import
taos
class
TwoClients
:
def
initConnection
(
self
):
self
.
host
=
"127.0.0.1"
self
.
user
=
"root"
self
.
password
=
"taosdata"
self
.
config
=
"/home/xp/git/TDengine/sim/dnode1/cfg"
def
run
(
self
):
tdDnodes
.
init
(
""
)
tdDnodes
.
setTestCluster
(
False
)
tdDnodes
.
setValgrind
(
False
)
tdDnodes
.
stopAll
()
tdDnodes
.
deploy
(
1
)
tdDnodes
.
start
(
1
)
# first client create a stable and insert data
conn1
=
taos
.
connect
(
self
.
host
,
self
.
user
,
self
.
password
,
self
.
config
)
cursor1
=
conn1
.
cursor
()
cursor1
.
execute
(
"drop database if exists db"
)
cursor1
.
execute
(
"create database db"
)
cursor1
.
execute
(
"use db"
)
cursor1
.
execute
(
"create table tb (ts timestamp, id int) tags(loc nchar(30))"
)
cursor1
.
execute
(
"insert into t0 using tb tags('beijing') values(now, 1)"
)
# second client alter the table created by cleint
conn2
=
taos
.
connect
(
self
.
host
,
self
.
user
,
self
.
password
,
self
.
config
)
cursor2
=
conn2
.
cursor
()
cursor2
.
execute
(
"use db"
)
cursor2
.
execute
(
"alter table tb add column name nchar(30)"
)
# first client should not be able to use the origin metadata
tdSql
.
init
(
cursor1
,
True
)
tdSql
.
error
(
"insert into t0 values(now, 2)"
)
# first client should be able to insert data with udpated medadata
tdSql
.
execute
(
"insert into t0 values(now, 2, 'test')"
)
tdSql
.
query
(
"select * from tb"
)
tdSql
.
checkRows
(
2
)
# second client drop the table
cursor2
.
execute
(
"drop table t0"
)
cursor2
.
execute
(
"create table t0 using tb tags('beijing')"
)
tdSql
.
execute
(
"insert into t0 values(now, 2, 'test')"
)
tdSql
.
query
(
"select * from tb"
)
tdSql
.
checkRows
(
1
)
# error expected for two clients drop the same cloumn
cursor2
.
execute
(
"alter table tb drop column name"
)
tdSql
.
error
(
"alter table tb drop column name"
)
cursor2
.
execute
(
"alter table tb add column speed int"
)
tdSql
.
error
(
"alter table tb add column speed int"
)
tdSql
.
execute
(
"alter table tb add column size int"
)
tdSql
.
query
(
"describe tb"
)
tdSql
.
checkRows
(
5
)
tdSql
.
checkData
(
0
,
0
,
"ts"
)
tdSql
.
checkData
(
1
,
0
,
"id"
)
tdSql
.
checkData
(
2
,
0
,
"speed"
)
tdSql
.
checkData
(
3
,
0
,
"size"
)
tdSql
.
checkData
(
4
,
0
,
"loc"
)
cursor1
.
close
()
cursor2
.
close
()
conn1
.
close
()
conn2
.
close
()
clients
=
TwoClients
()
clients
.
initConnection
()
clients
.
run
()
\ No newline at end of file
tests/pytest/fulltest.sh
浏览文件 @
efcd12c8
...
...
@@ -187,6 +187,7 @@ python3 ./test.py -f functions/function_top.py
#python3 ./test.py -f functions/function_twa.py
python3 queryCount.py
python3 ./test.py
-f
query/queryGroupbyWithInterval.py
python3 client/twoClients.py
# tools
python3 test.py
-f
tools/taosdemo.py
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录