Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ddd9b50e
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ddd9b50e
编写于
10月 29, 2020
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-1823] <test> add test case for data loss
上级
727ee9cc
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
112 addition
and
0 deletion
+112
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/query/dataLossTest.py
tests/pytest/query/dataLossTest.py
+76
-0
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+35
-0
未找到文件。
tests/pytest/fulltest.sh
浏览文件 @
ddd9b50e
...
@@ -152,6 +152,7 @@ python3 ./test.py -f query/queryInsertValue.py
...
@@ -152,6 +152,7 @@ python3 ./test.py -f query/queryInsertValue.py
python3 ./test.py
-f
query/queryConnection.py
python3 ./test.py
-f
query/queryConnection.py
python3 ./test.py
-f
query/natualInterval.py
python3 ./test.py
-f
query/natualInterval.py
python3 ./test.py
-f
query/bug1471.py
python3 ./test.py
-f
query/bug1471.py
python3 ./test.py
-f
query/dataLossTest.py
#stream
#stream
python3 ./test.py
-f
stream/metric_1.py
python3 ./test.py
-f
stream/metric_1.py
...
...
tests/pytest/query/dataLossTest.py
0 → 100644
浏览文件 @
ddd9b50e
###################################################################
# 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
import
os
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
import
inspect
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
numberOfTables
=
240
self
.
numberOfRecords
=
10000
def
run
(
self
):
tdSql
.
prepare
()
os
.
system
(
"yes | taosdemo -t %d -n %d"
%
(
self
.
numberOfTables
,
self
.
numberOfRecords
))
print
(
"==============step1"
)
tdSql
.
execute
(
"use test"
)
sql
=
"select count(*) from meters"
tdSql
.
query
(
sql
)
rows
=
tdSql
.
getData
(
0
,
0
)
print
(
"number of records: %d"
%
rows
)
newRows
=
rows
for
i
in
range
(
10000
):
print
(
"kill taosd"
)
time
.
sleep
(
10
)
os
.
system
(
"sudo kill -9 $(pgrep taosd)"
)
tdDnodes
.
startWithoutSleep
(
1
)
while
True
:
try
:
tdSql
.
query
(
sql
)
newRows
=
tdSql
.
getData
(
0
,
0
)
print
(
"numer of records after kill taosd %d"
%
newRows
)
time
.
sleep
(
10
)
break
except
Exception
as
e
:
pass
continue
if
newRows
<
rows
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
args
=
(
caller
.
filename
,
caller
.
lineno
,
sql
,
newRows
,
rows
)
tdLog
.
exit
(
"%s(%d) failed: sql:%s, queryRows:%d != expect:%d"
%
args
)
break
tdSql
.
query
(
sql
)
tdSql
.
checkData
(
0
,
0
,
rows
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/util/dnodes.py
浏览文件 @
ddd9b50e
...
@@ -15,6 +15,7 @@ import sys
...
@@ -15,6 +15,7 @@ import sys
import
os
import
os
import
os.path
import
os.path
import
subprocess
import
subprocess
from
time
import
sleep
from
util.log
import
*
from
util.log
import
*
...
@@ -210,6 +211,7 @@ class TDDnode:
...
@@ -210,6 +211,7 @@ class TDDnode:
(
self
.
index
,
self
.
cfgPath
))
(
self
.
index
,
self
.
cfgPath
))
def
getBuildPath
(
self
):
def
getBuildPath
(
self
):
buildPath
=
""
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
...
@@ -257,6 +259,35 @@ class TDDnode:
...
@@ -257,6 +259,35 @@ class TDDnode:
tdLog
.
debug
(
"wait 5 seconds for the dnode:%d to start."
%
(
self
.
index
))
tdLog
.
debug
(
"wait 5 seconds for the dnode:%d to start."
%
(
self
.
index
))
time
.
sleep
(
5
)
time
.
sleep
(
5
)
def
startWithoutSleep
(
self
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/taosd"
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
if
self
.
valgrind
==
0
:
cmd
=
"nohup %s -c %s > /dev/null 2>&1 & "
%
(
binPath
,
self
.
cfgDir
)
else
:
valgrindCmdline
=
"valgrind --tool=memcheck --leak-check=full --show-reachable=no --track-origins=yes --show-leak-kinds=all -v --workaround-gcc296-bugs=yes"
cmd
=
"nohup %s %s -c %s 2>&1 & "
%
(
valgrindCmdline
,
binPath
,
self
.
cfgDir
)
print
(
cmd
)
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
self
.
running
=
1
tdLog
.
debug
(
"dnode:%d is running with %s "
%
(
self
.
index
,
cmd
))
def
stop
(
self
):
def
stop
(
self
):
if
self
.
valgrind
==
0
:
if
self
.
valgrind
==
0
:
toBeKilled
=
"taosd"
toBeKilled
=
"taosd"
...
@@ -426,6 +457,10 @@ class TDDnodes:
...
@@ -426,6 +457,10 @@ class TDDnodes:
self
.
check
(
index
)
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
start
()
self
.
dnodes
[
index
-
1
].
start
()
def
startWithoutSleep
(
self
,
index
):
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
startWithoutSleep
()
def
stop
(
self
,
index
):
def
stop
(
self
,
index
):
self
.
check
(
index
)
self
.
check
(
index
)
self
.
dnodes
[
index
-
1
].
stop
()
self
.
dnodes
[
index
-
1
].
stop
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录