Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
455956a7
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看板
提交
455956a7
编写于
11月 03, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/update_test' of
https://github.com/taosdata/TDengine
into feature/update_test
上级
081c9c3f
3d51199f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
340 addition
and
67 deletion
+340
-67
tests/pytest/update/allow_update-0.py
tests/pytest/update/allow_update-0.py
+170
-0
tests/pytest/update/allow_update.py
tests/pytest/update/allow_update.py
+170
-67
未找到文件。
tests/pytest/update/allow_update-0.py
0 → 100644
浏览文件 @
455956a7
###################################################################
# 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
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
numOfRecords
=
10
self
.
ts
=
1604295582000
def
restartTaosd
(
self
):
tdDnodes
.
stop
(
1
)
tdDnodes
.
start
(
1
)
tdSql
.
execute
(
"use udb"
)
def
run
(
self
):
tdSql
.
prepare
()
startTs
=
self
.
ts
print
(
"==============step1"
)
tdSql
.
execute
(
"create database udb update 0"
)
tdSql
.
execute
(
"use udb"
)
tdSql
.
execute
(
"create table t (ts timestamp, a int)"
)
tdSql
.
execute
(
"insert into t values (%d, 1)"
%
(
startTs
))
tdSql
.
execute
(
"insert into t values (%d, 1)"
%
(
startTs
-
3
))
tdSql
.
execute
(
"insert into t values (%d, 1)"
%
(
startTs
+
3
))
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
checkData
(
1
,
0
,
1
)
tdSql
.
checkData
(
2
,
0
,
1
)
print
(
"==============step2"
)
tdSql
.
execute
(
"insert into t values (%d, 2)"
%
(
startTs
))
tdSql
.
execute
(
"insert into t values (%d, 2)"
%
(
startTs
-
3
))
tdSql
.
execute
(
"insert into t values (%d, 2)"
%
(
startTs
+
3
))
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
3
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
1
)
tdSql
.
checkData
(
1
,
0
,
1
)
tdSql
.
checkData
(
2
,
0
,
1
)
print
(
"==============step3"
)
tdSql
.
execute
(
"insert into t values (%d, 3)"
%
(
startTs
-
4
))
tdSql
.
execute
(
"insert into t values (%d, 3)"
%
(
startTs
-
2
))
tdSql
.
execute
(
"insert into t values (%d, 3)"
%
(
startTs
+
2
))
tdSql
.
execute
(
"insert into t values (%d, 3)"
%
(
startTs
+
4
))
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
7
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
3
)
tdSql
.
checkData
(
1
,
0
,
1
)
tdSql
.
checkData
(
2
,
0
,
3
)
tdSql
.
checkData
(
3
,
0
,
1
)
tdSql
.
checkData
(
4
,
0
,
3
)
tdSql
.
checkData
(
5
,
0
,
1
)
tdSql
.
checkData
(
6
,
0
,
3
)
print
(
"==============step4"
)
tdSql
.
execute
(
"insert into t values (%d, 4)"
%
(
startTs
-
4
))
tdSql
.
execute
(
"insert into t values (%d, 4)"
%
(
startTs
-
2
))
tdSql
.
execute
(
"insert into t values (%d, 4)"
%
(
startTs
+
2
))
tdSql
.
execute
(
"insert into t values (%d, 4)"
%
(
startTs
+
4
))
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
7
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
3
)
tdSql
.
checkData
(
1
,
0
,
1
)
tdSql
.
checkData
(
2
,
0
,
3
)
tdSql
.
checkData
(
3
,
0
,
1
)
tdSql
.
checkData
(
4
,
0
,
3
)
tdSql
.
checkData
(
5
,
0
,
1
)
tdSql
.
checkData
(
6
,
0
,
3
)
print
(
"==============step5"
)
tdSql
.
execute
(
"insert into t values (%d, 5)"
%
(
startTs
-
1
))
tdSql
.
execute
(
"insert into t values (%d, 5)"
%
(
startTs
+
1
))
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
3
)
tdSql
.
checkData
(
1
,
0
,
1
)
tdSql
.
checkData
(
2
,
0
,
3
)
tdSql
.
checkData
(
3
,
0
,
5
)
tdSql
.
checkData
(
4
,
0
,
1
)
tdSql
.
checkData
(
5
,
0
,
5
)
tdSql
.
checkData
(
6
,
0
,
3
)
tdSql
.
checkData
(
7
,
0
,
1
)
tdSql
.
checkData
(
8
,
0
,
3
)
print
(
"==============step6"
)
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
-
4
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
-
3
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
-
2
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
-
1
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
+
1
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
+
2
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
+
3
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
+
4
))
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
3
)
tdSql
.
checkData
(
1
,
0
,
1
)
tdSql
.
checkData
(
2
,
0
,
3
)
tdSql
.
checkData
(
3
,
0
,
5
)
tdSql
.
checkData
(
4
,
0
,
1
)
tdSql
.
checkData
(
5
,
0
,
5
)
tdSql
.
checkData
(
6
,
0
,
3
)
tdSql
.
checkData
(
7
,
0
,
1
)
tdSql
.
checkData
(
8
,
0
,
3
)
# restart taosd to commit, and check
self
.
restartTaosd
();
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
3
)
tdSql
.
checkData
(
1
,
0
,
1
)
tdSql
.
checkData
(
2
,
0
,
3
)
tdSql
.
checkData
(
3
,
0
,
5
)
tdSql
.
checkData
(
4
,
0
,
1
)
tdSql
.
checkData
(
5
,
0
,
5
)
tdSql
.
checkData
(
6
,
0
,
3
)
tdSql
.
checkData
(
7
,
0
,
1
)
tdSql
.
checkData
(
8
,
0
,
3
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/update/allow_update.py
浏览文件 @
455956a7
# For step 1, we set all the values as 1
###################################################################
# for step 2, we set all the values as 2
# Copyright (c) 2016 by TAOS Technologies, Inc.
# and so on
# All rights reserved.
# check query result here means not
#
# This file is proprietary and confidential to TAOS Technologies.
# clear env set up
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# create database db update 1
# expressly provided by the written permission from Jianhui Tao
#
# create table t (ts timestamp, a int)
###################################################################
# set an init time (such as $t0 = 1604295582000)
# -*- coding: utf-8 -*-
# Step 1
import
sys
insert
into
t
values
(
$
t0
,
1
);
import
taos
insert
into
t
values
(
$
t0
-
3
,
1
);
from
util.log
import
*
insert
into
t
values
(
$
t0
+
3
,
1
);
from
util.cases
import
*
from
util.sql
import
*
check
query
result
from
util.dnodes
import
*
# Step 2
insert
into
t
values
(
$
t0
,
2
);
class
TDTestCase
:
insert
into
t
values
(
$
t0
-
3
,
2
);
def
init
(
self
,
conn
,
logSql
):
insert
into
t
values
(
$
t0
+
3
,
2
);
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
check
query
result
self
.
numOfRecords
=
10
# Step 3
self
.
ts
=
1604295582000
insert
into
t
values
(
$
t0
-
4
,
3
);
insert
into
t
values
(
$
t0
-
2
,
3
);
def
restartTaosd
(
self
):
insert
into
t
values
(
$
t0
+
2
,
3
);
tdDnodes
.
stop
(
1
)
insert
into
t
values
(
$
t0
+
4
,
3
);
tdDnodes
.
start
(
1
)
tdSql
.
execute
(
"use udb"
)
check
query
result
def
run
(
self
):
# Step 4
tdSql
.
prepare
()
insert
into
t
values
(
$
t0
-
4
,
4
);
startTs
=
self
.
ts
insert
into
t
values
(
$
t0
-
2
,
4
);
insert
into
t
values
(
$
t0
+
2
,
4
);
print
(
"==============step1"
)
insert
into
t
values
(
$
t0
+
4
,
4
);
tdSql
.
execute
(
"create database udb update 1"
)
tdSql
.
execute
(
"use udb"
)
check
query
result
tdSql
.
execute
(
"create table t (ts timestamp, a int)"
)
tdSql
.
execute
(
"insert into t values (%d, 1)"
%
(
startTs
))
# Step 4
tdSql
.
execute
(
"insert into t values (%d, 1)"
%
(
startTs
-
3
))
insert
into
t
values
(
$
t0
-
1
,
5
);
tdSql
.
execute
(
"insert into t values (%d, 1)"
%
(
startTs
+
3
))
insert
into
t
values
(
$
t0
+
1
,
5
);
tdSql
.
query
(
"select * from t"
)
check
query
result
tdSql
.
checkRows
(
3
)
# Step 4
tdSql
.
query
(
"select a from t"
)
insert
into
t
values
(
$
t0
-
4
,
6
);
tdSql
.
checkData
(
0
,
0
,
1
)
insert
into
t
values
(
$
t0
-
3
,
6
);
tdSql
.
checkData
(
1
,
0
,
1
)
insert
into
t
values
(
$
t0
-
2
,
6
);
tdSql
.
checkData
(
2
,
0
,
1
)
insert
into
t
values
(
$
t0
-
1
,
6
);
insert
into
t
values
(
$
t0
,
6
);
print
(
"==============step2"
)
insert
into
t
values
(
$
t0
+
1
,
6
);
tdSql
.
execute
(
"insert into t values (%d, 2)"
%
(
startTs
))
insert
into
t
values
(
$
t0
+
2
,
6
);
tdSql
.
execute
(
"insert into t values (%d, 2)"
%
(
startTs
-
3
))
insert
into
t
values
(
$
t0
+
3
,
6
);
tdSql
.
execute
(
"insert into t values (%d, 2)"
%
(
startTs
+
3
))
insert
into
t
values
(
$
t0
+
4
,
6
);
tdSql
.
query
(
"select * from t"
)
check
query
result
tdSql
.
checkRows
(
3
)
# Step 4
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
2
)
restart
to
commit
tdSql
.
checkData
(
1
,
0
,
2
)
tdSql
.
checkData
(
2
,
0
,
2
)
check
query
result
\ No newline at end of file
print
(
"==============step3"
)
tdSql
.
execute
(
"insert into t values (%d, 3)"
%
(
startTs
-
4
))
tdSql
.
execute
(
"insert into t values (%d, 3)"
%
(
startTs
-
2
))
tdSql
.
execute
(
"insert into t values (%d, 3)"
%
(
startTs
+
2
))
tdSql
.
execute
(
"insert into t values (%d, 3)"
%
(
startTs
+
4
))
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
7
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
3
)
tdSql
.
checkData
(
1
,
0
,
2
)
tdSql
.
checkData
(
2
,
0
,
3
)
tdSql
.
checkData
(
3
,
0
,
2
)
tdSql
.
checkData
(
4
,
0
,
3
)
tdSql
.
checkData
(
5
,
0
,
2
)
tdSql
.
checkData
(
6
,
0
,
3
)
print
(
"==============step4"
)
tdSql
.
execute
(
"insert into t values (%d, 4)"
%
(
startTs
-
4
))
tdSql
.
execute
(
"insert into t values (%d, 4)"
%
(
startTs
-
2
))
tdSql
.
execute
(
"insert into t values (%d, 4)"
%
(
startTs
+
2
))
tdSql
.
execute
(
"insert into t values (%d, 4)"
%
(
startTs
+
4
))
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
7
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
4
)
tdSql
.
checkData
(
1
,
0
,
2
)
tdSql
.
checkData
(
2
,
0
,
4
)
tdSql
.
checkData
(
3
,
0
,
2
)
tdSql
.
checkData
(
4
,
0
,
4
)
tdSql
.
checkData
(
5
,
0
,
2
)
tdSql
.
checkData
(
6
,
0
,
4
)
print
(
"==============step5"
)
tdSql
.
execute
(
"insert into t values (%d, 5)"
%
(
startTs
-
1
))
tdSql
.
execute
(
"insert into t values (%d, 5)"
%
(
startTs
+
1
))
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
4
)
tdSql
.
checkData
(
1
,
0
,
2
)
tdSql
.
checkData
(
2
,
0
,
4
)
tdSql
.
checkData
(
3
,
0
,
5
)
tdSql
.
checkData
(
4
,
0
,
2
)
tdSql
.
checkData
(
5
,
0
,
5
)
tdSql
.
checkData
(
6
,
0
,
4
)
tdSql
.
checkData
(
7
,
0
,
2
)
tdSql
.
checkData
(
8
,
0
,
4
)
print
(
"==============step6"
)
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
-
4
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
-
3
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
-
2
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
-
1
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
+
1
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
+
2
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
+
3
))
tdSql
.
execute
(
"insert into t values (%d, 6)"
%
(
startTs
+
4
))
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
6
)
tdSql
.
checkData
(
1
,
0
,
6
)
tdSql
.
checkData
(
2
,
0
,
6
)
tdSql
.
checkData
(
3
,
0
,
6
)
tdSql
.
checkData
(
4
,
0
,
6
)
tdSql
.
checkData
(
5
,
0
,
6
)
tdSql
.
checkData
(
6
,
0
,
6
)
tdSql
.
checkData
(
7
,
0
,
6
)
tdSql
.
checkData
(
8
,
0
,
6
)
# restart taosd to commit, and check
self
.
restartTaosd
();
tdSql
.
query
(
"select * from t"
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select a from t"
)
tdSql
.
checkData
(
0
,
0
,
6
)
tdSql
.
checkData
(
1
,
0
,
6
)
tdSql
.
checkData
(
2
,
0
,
6
)
tdSql
.
checkData
(
3
,
0
,
6
)
tdSql
.
checkData
(
4
,
0
,
6
)
tdSql
.
checkData
(
5
,
0
,
6
)
tdSql
.
checkData
(
6
,
0
,
6
)
tdSql
.
checkData
(
7
,
0
,
6
)
tdSql
.
checkData
(
8
,
0
,
6
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录