Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f81acb0a
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看板
提交
f81acb0a
编写于
9月 13, 2022
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '2.6' of github.com:taosdata/TDengine into szhou/2.6/fixbugs
上级
5efee383
db9dad4a
变更
21
显示空白变更内容
内联
并排
Showing
21 changed file
with
1627 addition
and
874 deletion
+1627
-874
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+2
-2
src/kit/taos-tools
src/kit/taos-tools
+1
-1
tests/develop-test/5-taos-tools/taosdump/taosdumpDbNtb.py
tests/develop-test/5-taos-tools/taosdump/taosdumpDbNtb.py
+131
-0
tests/develop-test/5-taos-tools/taosdump/taosdumpDbStb.py
tests/develop-test/5-taos-tools/taosdump/taosdumpDbStb.py
+131
-0
tests/develop-test/5-taos-tools/taosdump/taosdumpManyCols.py
tests/develop-test/5-taos-tools/taosdump/taosdumpManyCols.py
+144
-0
tests/develop-test/5-taos-tools/taosdump/taosdumpTestBasic.py
...s/develop-test/5-taos-tools/taosdump/taosdumpTestBasic.py
+131
-0
tests/develop-test/5-taos-tools/taosdump/taosdumpTestInspect.py
...develop-test/5-taos-tools/taosdump/taosdumpTestInspect.py
+81
-36
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeBigInt.py
...elop-test/5-taos-tools/taosdump/taosdumpTestTypeBigInt.py
+16
-5
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeBinary.py
...elop-test/5-taos-tools/taosdump/taosdumpTestTypeBinary.py
+22
-9
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeBool.py
...evelop-test/5-taos-tools/taosdump/taosdumpTestTypeBool.py
+24
-13
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeDouble.py
...elop-test/5-taos-tools/taosdump/taosdumpTestTypeDouble.py
+16
-5
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeFloat.py
...velop-test/5-taos-tools/taosdump/taosdumpTestTypeFloat.py
+16
-5
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeInt.py
...develop-test/5-taos-tools/taosdump/taosdumpTestTypeInt.py
+28
-16
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeJson.py
...evelop-test/5-taos-tools/taosdump/taosdumpTestTypeJson.py
+41
-10
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeSmallInt.py
...op-test/5-taos-tools/taosdump/taosdumpTestTypeSmallInt.py
+29
-17
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeTinyInt.py
...lop-test/5-taos-tools/taosdump/taosdumpTestTypeTinyInt.py
+16
-5
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeUnsignedBigInt.py
...t/5-taos-tools/taosdump/taosdumpTestTypeUnsignedBigInt.py
+16
-5
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeUnsignedInt.py
...test/5-taos-tools/taosdump/taosdumpTestTypeUnsignedInt.py
+16
-5
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeUnsignedSmallInt.py
...5-taos-tools/taosdump/taosdumpTestTypeUnsignedSmallInt.py
+16
-5
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeUnsignedTinyInt.py
.../5-taos-tools/taosdump/taosdumpTestTypeUnsignedTinyInt.py
+16
-5
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+734
-730
未找到文件。
src/client/src/tscParseLineProtocol.c
浏览文件 @
f81acb0a
...
@@ -97,9 +97,9 @@ static int32_t getFieldBytesFromSmlKv(TAOS_SML_KV* kv, int32_t* bytes, uint64_t
...
@@ -97,9 +97,9 @@ static int32_t getFieldBytesFromSmlKv(TAOS_SML_KV* kv, int32_t* bytes, uint64_t
// }
// }
// free(ucs);
// free(ucs);
// *bytes = bytesNeeded + VARSTR_HEADER_SIZE;
// *bytes = bytesNeeded + VARSTR_HEADER_SIZE;
*
bytes
=
kv
->
length
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
;
*
bytes
=
(
kv
->
length
==
0
?
1
:
kv
->
length
)
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
;
}
else
if
(
kv
->
type
==
TSDB_DATA_TYPE_BINARY
)
{
}
else
if
(
kv
->
type
==
TSDB_DATA_TYPE_BINARY
)
{
*
bytes
=
kv
->
length
+
VARSTR_HEADER_SIZE
;
*
bytes
=
(
kv
->
length
==
0
?
1
:
kv
->
length
)
+
VARSTR_HEADER_SIZE
;
}
}
}
}
return
0
;
return
0
;
...
...
taos-tools
@
2dba49cf
比较
7d5c1c01
...
2dba49cf
Subproject commit
7d5c1c016d2022d152a6aaa38589f2fbaa0d25a4
Subproject commit
2dba49cf57cde998f768bb033619b4d8c5143127
tests/develop-test/5-taos-tools/taosdump/taosdumpDbNtb.py
0 → 100644
浏览文件 @
f81acb0a
###################################################################
# 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
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
caseDescription
(
self
):
'''
case1<sdsang>: [TD-18291] taosdump basic test
'''
return
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
tmpdir
=
"tmp"
def
getPath
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
((
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
if
(
len
(
paths
)
==
0
):
return
""
return
paths
[
0
]
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db keep 3649 "
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)"
)
tdSql
.
execute
(
"create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
"insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
"create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
tdSql
.
execute
(
"insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
tdSql
.
execute
(
"create table db.nt1 (ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)"
)
tdSql
.
execute
(
"insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
"insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
# sys.exit(1)
binPath
=
self
.
getPath
(
"taosdump"
)
if
(
binPath
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
binPath
)
if
not
os
.
path
.
exists
(
self
.
tmpdir
):
os
.
makedirs
(
self
.
tmpdir
)
else
:
print
(
"directory exists"
)
os
.
system
(
"rm -rf %s"
%
self
.
tmpdir
)
os
.
makedirs
(
self
.
tmpdir
)
os
.
system
(
"%s db t1 -o %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
execute
(
"drop database db"
)
# sys.exit(1)
os
.
system
(
"%s -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'st'
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
1
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/develop-test/5-taos-tools/taosdump/taosdumpDbStb.py
0 → 100644
浏览文件 @
f81acb0a
###################################################################
# 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
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
caseDescription
(
self
):
'''
case1<sdsang>: [TD-18291] taosdump basic test
'''
return
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
tmpdir
=
"tmp"
def
getPath
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
((
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
if
(
len
(
paths
)
==
0
):
return
""
return
paths
[
0
]
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db keep 3649 "
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)"
)
tdSql
.
execute
(
"create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
"insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
"create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
tdSql
.
execute
(
"insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
tdSql
.
execute
(
"create table db.nt1 (ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)"
)
tdSql
.
execute
(
"insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
"insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
# sys.exit(1)
binPath
=
self
.
getPath
(
"taosdump"
)
if
(
binPath
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
binPath
)
if
not
os
.
path
.
exists
(
self
.
tmpdir
):
os
.
makedirs
(
self
.
tmpdir
)
else
:
print
(
"directory exists"
)
os
.
system
(
"rm -rf %s"
%
self
.
tmpdir
)
os
.
makedirs
(
self
.
tmpdir
)
os
.
system
(
"%s db st -o %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
execute
(
"drop database db"
)
# sys.exit(1)
os
.
system
(
"%s -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'st'
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
2
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/develop-test/5-taos-tools/taosdump/taosdumpManyCols.py
0 → 100644
浏览文件 @
f81acb0a
###################################################################
# 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
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
caseDescription
(
self
):
'''
case1<sdsang>: [TS-1762] taosdump with many columns
'''
return
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
tmpdir
=
"tmp"
def
getPath
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
((
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
if
(
len
(
paths
)
==
0
):
return
""
return
paths
[
0
]
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db keep 3649 "
)
tdSql
.
execute
(
"use db"
)
stb_sql
=
"create stable stb(ts timestamp"
for
index
in
range
(
4095
-
128
):
stb_sql
+=
(
", col%d INT"
%
(
index
+
1
))
stb_sql
+=
") tags(tag0 INT"
for
index
in
range
(
127
):
stb_sql
+=
(
", tag%d INT"
%
(
index
+
1
))
stb_sql
+=
")"
tdSql
.
execute
(
stb_sql
);
# sys.exit(1)
tb_sql
=
"create table tb using stb tags(0"
for
index
in
range
(
127
):
tb_sql
+=
(
",%d"
%
(
index
+
1
))
tb_sql
+=
")"
tdSql
.
execute
(
tb_sql
);
# sys.exit(1)
for
record
in
range
(
100
):
ins_sql
=
(
"insert into tb values(%d"
%
(
1640000000000
+
record
))
for
index
in
range
(
4095
-
128
):
ins_sql
+=
(
",%d"
%
index
)
ins_sql
+=
")"
tdSql
.
execute
(
ins_sql
);
binPath
=
self
.
getPath
(
"taosdump"
)
if
(
binPath
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
binPath
)
if
not
os
.
path
.
exists
(
self
.
tmpdir
):
os
.
makedirs
(
self
.
tmpdir
)
else
:
print
(
"directory exists"
)
os
.
system
(
"rm -rf %s"
%
self
.
tmpdir
)
os
.
makedirs
(
self
.
tmpdir
)
os
.
system
(
"%s db -o %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
execute
(
"drop database db"
)
# sys.exit(1)
os
.
system
(
"%s -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'stb'
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'tb'
)
tdSql
.
query
(
"select count(*) from db.stb"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
100
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/develop-test/5-taos-tools/taosdump/taosdumpTestBasic.py
0 → 100644
浏览文件 @
f81acb0a
###################################################################
# 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
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
caseDescription
(
self
):
'''
case1<sdsang>: [TD-18291] taosdump basic test
'''
return
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
tmpdir
=
"tmp"
def
getPath
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
((
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
if
(
len
(
paths
)
==
0
):
return
""
return
paths
[
0
]
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db keep 3649 "
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)"
)
tdSql
.
execute
(
"create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
"insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
"create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
tdSql
.
execute
(
"insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
tdSql
.
execute
(
"create table db.nt1 (ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED)"
)
tdSql
.
execute
(
"insert into nt1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
"insert into nt1 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
# sys.exit(1)
binPath
=
self
.
getPath
(
"taosdump"
)
if
(
binPath
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
else
:
tdLog
.
info
(
"taosdump found in %s"
%
binPath
)
if
not
os
.
path
.
exists
(
self
.
tmpdir
):
os
.
makedirs
(
self
.
tmpdir
)
else
:
print
(
"directory exists"
)
os
.
system
(
"rm -rf %s"
%
self
.
tmpdir
)
os
.
makedirs
(
self
.
tmpdir
)
os
.
system
(
"%s -D db -o %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
execute
(
"drop database db"
)
# sys.exit(1)
os
.
system
(
"%s -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
'st'
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
3
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/develop-test/5-taos-tools/taosdump/taosdumpTestInspect.py
浏览文件 @
f81acb0a
...
@@ -11,20 +11,18 @@
...
@@ -11,20 +11,18 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
def
caseDescription
(
self
):
def
caseDescription
(
self
):
'''
"""
case1<sdsang>: [TD-14544] taosdump data inspect
case1<sdsang>: [TD-14544] taosdump data inspect
'''
"""
return
return
def
init
(
self
,
conn
,
logSql
):
def
init
(
self
,
conn
,
logSql
):
...
@@ -35,19 +33,23 @@ class TDTestCase:
...
@@ -35,19 +33,23 @@ class TDTestCase:
def
getPath
(
self
,
tool
=
"taosdump"
):
def
getPath
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
if
"community"
in
selfPath
:
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
"src"
in
selfPath
:
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
"/tools/"
in
selfPath
:
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
paths
=
[]
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
(
tool
)
in
files
)
:
if
(
tool
)
in
files
:
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
)
:
if
"packaging"
not
in
rootRealPath
:
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
break
if
(
len
(
paths
)
==
0
)
:
if
len
(
paths
)
==
0
:
return
""
return
""
return
paths
[
0
]
return
paths
[
0
]
...
@@ -55,24 +57,29 @@ class TDTestCase:
...
@@ -55,24 +57,29 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
"create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)"
)
"create table st(ts timestamp, c1 INT, c2 BOOL, c3 TINYINT, c4 SMALLINT, c5 BIGINT, c6 FLOAT, c7 DOUBLE, c8 TIMESTAMP, c9 BINARY(10), c10 NCHAR(10), c11 TINYINT UNSIGNED, c12 SMALLINT UNSIGNED, c13 INT UNSIGNED, c14 BIGINT UNSIGNED) tags(n1 INT, w2 BOOL, t3 TINYINT, t4 SMALLINT, t5 BIGINT, t6 FLOAT, t7 DOUBLE, t8 TIMESTAMP, t9 BINARY(10), t10 NCHAR(10), t11 TINYINT UNSIGNED, t12 SMALLINT UNSIGNED, t13 INT UNSIGNED, t14 BIGINT UNSIGNED)"
)
tdSql
.
execute
(
tdSql
.
execute
(
"create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
"create table t1 using st tags(1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
tdSql
.
execute
(
"insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
"insert into t1 values(1640000000000, 1, true, 1, 1, 1, 1.0, 1.0, 1, '1', '一', 1, 1, 1, 1)"
)
tdSql
.
execute
(
tdSql
.
execute
(
"create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
"create table t2 using st tags(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
tdSql
.
execute
(
tdSql
.
execute
(
"insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
"insert into t2 values(1640000000000, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"
)
# sys.exit(1)
# sys.exit(1)
binPath
=
self
.
getPath
(
"taosdump"
)
binPath
=
self
.
getPath
(
"taosdump"
)
if
(
binPath
==
""
)
:
if
binPath
==
""
:
tdLog
.
exit
(
"taosdump not found!"
)
tdLog
.
exit
(
"taosdump not found!"
)
else
:
else
:
tdLog
.
info
(
"taosdump found in %s"
%
binPath
)
tdLog
.
info
(
"taosdump found in %s"
%
binPath
)
...
@@ -84,35 +91,73 @@ class TDTestCase:
...
@@ -84,35 +91,73 @@ class TDTestCase:
os
.
system
(
"rm -rf %s"
%
self
.
tmpdir
)
os
.
system
(
"rm -rf %s"
%
self
.
tmpdir
)
os
.
makedirs
(
self
.
tmpdir
)
os
.
makedirs
(
self
.
tmpdir
)
os
.
system
(
os
.
system
(
"%s --databases db -o %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
"%s --databases db -o %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
# sys.exit(1)
# sys.exit(1)
taosdumpInspectCmd
=
"%s -I %s/*.avro* -s | grep 'Schema:'|wc -l"
%
(
taosdumpInspectCmd
=
"%s -I %s/taosdump.*/*.avro* -s | grep 'Schema:'|wc -l"
%
(
binPath
,
self
.
tmpdir
)
binPath
,
schemaTimes
=
subprocess
.
check_output
(
self
.
tmpdir
,
taosdumpInspectCmd
,
shell
=
True
).
decode
(
"utf-8"
)
)
schemaTimes
=
subprocess
.
check_output
(
taosdumpInspectCmd
,
shell
=
True
).
decode
(
"utf-8"
)
print
(
"schema found times: %d"
%
int
(
schemaTimes
))
print
(
"schema found times: %d"
%
int
(
schemaTimes
))
if
(
int
(
schemaTimes
)
!=
3
)
:
if
int
(
schemaTimes
)
!=
1
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
0
][
0
])
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
0
][
0
])
tdLog
.
exit
(
tdLog
.
exit
(
"%s(%d) failed: expected schema found times 3, actual %d"
%
"%s(%d) failed: expected schema found times 1, actual %d"
(
caller
.
filename
,
caller
.
lineno
,
int
(
schemaTimes
)))
%
(
caller
.
filename
,
caller
.
lineno
,
int
(
schemaTimes
))
)
taosdumpInspectCmd
=
(
"%s -I %s/taosdump*/data*/*.avro* -s | grep 'Schema:'|wc -l"
%
(
binPath
,
self
.
tmpdir
)
)
schemaTimes
=
subprocess
.
check_output
(
taosdumpInspectCmd
,
shell
=
True
).
decode
(
"utf-8"
)
print
(
"schema found times: %d"
%
int
(
schemaTimes
))
taosdumpInspectCmd
=
"%s -I %s/*.avro* | grep '=== Records:'|wc -l"
%
(
if
int
(
schemaTimes
)
!=
2
:
binPath
,
self
.
tmpdir
)
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
0
][
0
])
recordsTimes
=
subprocess
.
check_output
(
tdLog
.
exit
(
taosdumpInspectCmd
,
shell
=
True
).
decode
(
"utf-8"
)
"%s(%d) failed: expected schema found times 2, actual %d"
%
(
caller
.
filename
,
caller
.
lineno
,
int
(
schemaTimes
))
)
taosdumpInspectCmd
=
(
"%s -I %s/taosdump*/*.avro* | grep '=== Records:'|wc -l"
%
(
binPath
,
self
.
tmpdir
)
)
recordsTimes
=
subprocess
.
check_output
(
taosdumpInspectCmd
,
shell
=
True
).
decode
(
"utf-8"
)
print
(
"records found times: %d"
%
int
(
recordsTimes
))
if
int
(
recordsTimes
)
!=
1
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
0
][
0
])
tdLog
.
exit
(
"%s(%d) failed: expected records found times 1, actual %d"
%
(
caller
.
filename
,
caller
.
lineno
,
int
(
recordsTimes
))
)
taosdumpInspectCmd
=
(
"%s -I %s/taosdump*/data*/*.avro* | grep '=== Records:'|wc -l"
%
(
binPath
,
self
.
tmpdir
)
)
recordsTimes
=
subprocess
.
check_output
(
taosdumpInspectCmd
,
shell
=
True
).
decode
(
"utf-8"
)
print
(
"records found times: %d"
%
int
(
recordsTimes
))
print
(
"records found times: %d"
%
int
(
recordsTimes
))
if
(
int
(
recordsTimes
)
!=
3
)
:
if
int
(
recordsTimes
)
!=
2
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
0
][
0
])
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
0
][
0
])
tdLog
.
exit
(
tdLog
.
exit
(
"%s(%d) failed: expected records found times 3, actual %d"
%
"%s(%d) failed: expected records found times 2, actual %d"
(
caller
.
filename
,
caller
.
lineno
,
int
(
recordsTimes
)))
%
(
caller
.
filename
,
caller
.
lineno
,
int
(
recordsTimes
))
)
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeBigInt.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -37,8 +35,12 @@ class TDTestCase:
...
@@ -37,8 +35,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
buildPath
=
""
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
@@ -53,7 +55,7 @@ class TDTestCase:
...
@@ -53,7 +55,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -98,7 +100,16 @@ class TDTestCase:
...
@@ -98,7 +100,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeBinary.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -37,8 +35,12 @@ class TDTestCase:
...
@@ -37,8 +35,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
buildPath
=
""
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
@@ -53,7 +55,7 @@ class TDTestCase:
...
@@ -53,7 +55,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -86,7 +88,16 @@ class TDTestCase:
...
@@ -86,7 +88,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
@@ -95,14 +106,16 @@ class TDTestCase:
...
@@ -95,14 +106,16 @@ class TDTestCase:
tdSql
.
query
(
"show tables"
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkRows
(
2
)
tdSql
.
checkData
(
0
,
0
,
't2'
)
dbresult
=
tdSql
.
queryResult
tdSql
.
checkData
(
1
,
0
,
't1'
)
print
(
dbresult
)
for
i
in
range
(
len
(
dbresult
)):
assert
((
dbresult
[
i
][
0
]
==
"t1"
)
or
(
dbresult
[
i
][
0
]
==
"t2"
))
tdSql
.
query
(
"select
btag
from st where tbname = 't1'"
)
tdSql
.
query
(
"select
distinct(btag)
from st where tbname = 't1'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
"test"
)
tdSql
.
checkData
(
0
,
0
,
"test"
)
tdSql
.
query
(
"select
btag
from st where tbname = 't2'"
)
tdSql
.
query
(
"select
distinct(btag)
from st where tbname = 't2'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
0
,
None
)
tdSql
.
checkData
(
0
,
0
,
None
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeBool.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -37,8 +35,12 @@ class TDTestCase:
...
@@ -37,8 +35,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
buildPath
=
""
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
@@ -53,7 +55,7 @@ class TDTestCase:
...
@@ -53,7 +55,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -87,7 +89,16 @@ class TDTestCase:
...
@@ -87,7 +89,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
@@ -96,22 +107,22 @@ class TDTestCase:
...
@@ -96,22 +107,22 @@ class TDTestCase:
tdSql
.
query
(
"show tables"
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
't3'
)
dbresult
=
tdSql
.
queryResult
tdSql
.
checkData
(
1
,
0
,
't2'
)
print
(
dbresult
)
tdSql
.
checkData
(
2
,
0
,
't1'
)
for
i
in
range
(
len
(
dbresult
)):
assert
((
dbresult
[
i
][
0
]
==
"t1"
)
or
(
dbresult
[
i
][
0
]
==
"t2"
)
or
(
dbresult
[
i
][
0
]
==
"t3"
))
tdSql
.
query
(
"select btag from st"
)
tdSql
.
query
(
"select btag from st"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
"False"
)
dbresult
=
tdSql
.
queryResult
tdSql
.
checkData
(
1
,
0
,
"True"
)
print
(
dbresult
)
tdSql
.
checkData
(
2
,
0
,
None
)
tdSql
.
query
(
"select * from st where btag =
'true'
"
)
tdSql
.
query
(
"select * from st where btag =
true
"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
"True"
)
tdSql
.
checkData
(
0
,
1
,
"True"
)
tdSql
.
checkData
(
0
,
2
,
"True"
)
tdSql
.
checkData
(
0
,
2
,
"True"
)
tdSql
.
query
(
"select * from st where btag =
'false'
"
)
tdSql
.
query
(
"select * from st where btag =
false
"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
"False"
)
tdSql
.
checkData
(
0
,
1
,
"False"
)
tdSql
.
checkData
(
0
,
2
,
"False"
)
tdSql
.
checkData
(
0
,
2
,
"False"
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeDouble.py
浏览文件 @
f81acb0a
...
@@ -11,14 +11,12 @@
...
@@ -11,14 +11,12 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
import
math
import
math
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -38,8 +36,12 @@ class TDTestCase:
...
@@ -38,8 +36,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
buildPath
=
""
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
@@ -54,7 +56,7 @@ class TDTestCase:
...
@@ -54,7 +56,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -97,7 +99,16 @@ class TDTestCase:
...
@@ -97,7 +99,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeFloat.py
浏览文件 @
f81acb0a
...
@@ -11,14 +11,12 @@
...
@@ -11,14 +11,12 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
import
math
import
math
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -38,8 +36,12 @@ class TDTestCase:
...
@@ -38,8 +36,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
buildPath
=
""
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
@@ -54,7 +56,7 @@ class TDTestCase:
...
@@ -54,7 +56,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -97,7 +99,16 @@ class TDTestCase:
...
@@ -97,7 +99,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeInt.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -32,28 +30,34 @@ class TDTestCase:
...
@@ -32,28 +30,34 @@ class TDTestCase:
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
tmpdir
=
"tmp"
self
.
tmpdir
=
"tmp"
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosdump"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
break
return
buildPath
if
(
len
(
paths
)
==
0
):
return
""
return
paths
[
0
]
def
run
(
self
):
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -69,12 +73,11 @@ class TDTestCase:
...
@@ -69,12 +73,11 @@ class TDTestCase:
# sys.exit(1)
# sys.exit(1)
b
uildPath
=
self
.
getBuild
Path
()
b
inPath
=
self
.
get
Path
()
if
(
b
uild
Path
==
""
):
if
(
b
in
Path
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
tdLog
.
exit
(
"taosdump not found!"
)
else
:
else
:
tdLog
.
info
(
"taosdump found in %s"
%
buildPath
)
tdLog
.
info
(
"taosdump found in %s"
%
binPath
)
binPath
=
buildPath
+
"/build/bin/"
if
not
os
.
path
.
exists
(
self
.
tmpdir
):
if
not
os
.
path
.
exists
(
self
.
tmpdir
):
os
.
makedirs
(
self
.
tmpdir
)
os
.
makedirs
(
self
.
tmpdir
)
...
@@ -84,16 +87,25 @@ class TDTestCase:
...
@@ -84,16 +87,25 @@ class TDTestCase:
os
.
makedirs
(
self
.
tmpdir
)
os
.
makedirs
(
self
.
tmpdir
)
os
.
system
(
os
.
system
(
"%s
taosdump
--databases db -o %s -T 1"
%
"%s --databases db -o %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
(
binPath
,
self
.
tmpdir
))
# sys.exit(1)
# sys.exit(1)
tdSql
.
execute
(
"drop database db"
)
tdSql
.
execute
(
"drop database db"
)
os
.
system
(
"%s
taosdump
-i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%s -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeJson.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -37,8 +35,12 @@ class TDTestCase:
...
@@ -37,8 +35,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
buildPath
=
""
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
@@ -53,7 +55,7 @@ class TDTestCase:
...
@@ -53,7 +55,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -93,7 +95,16 @@ class TDTestCase:
...
@@ -93,7 +95,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s -g"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s -g"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
@@ -102,11 +113,24 @@ class TDTestCase:
...
@@ -102,11 +113,24 @@ class TDTestCase:
tdSql
.
query
(
"show tables"
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
't3'
)
dbresult
=
tdSql
.
queryResult
print
(
dbresult
)
for
i
in
range
(
len
(
dbresult
)):
assert
((
dbresult
[
i
][
0
]
==
"t1"
)
or
(
dbresult
[
i
][
0
]
==
"t2"
)
or
(
dbresult
[
i
][
0
]
==
"t3"
))
tdSql
.
query
(
"select jtag->'location' from st"
)
tdSql
.
query
(
"select jtag->'location' from st"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
"
\"
beijing
\"
"
)
dbresult
=
tdSql
.
queryResult
print
(
dbresult
)
found
=
False
for
i
in
range
(
len
(
dbresult
)):
if
(
dbresult
[
i
][
0
]
==
"
\"
beijing
\"
"
):
found
=
True
break
assert
found
==
True
tdSql
.
query
(
"select * from st where jtag contains 'location'"
)
tdSql
.
query
(
"select * from st where jtag contains 'location'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkRows
(
1
)
...
@@ -115,9 +139,16 @@ class TDTestCase:
...
@@ -115,9 +139,16 @@ class TDTestCase:
tdSql
.
query
(
"select jtag from st"
)
tdSql
.
query
(
"select jtag from st"
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkRows
(
3
)
tdSql
.
checkData
(
0
,
0
,
"{
\"
location
\"
:
\"
beijing
\"
}"
)
tdSql
.
checkData
(
1
,
0
,
None
)
dbresult
=
tdSql
.
queryResult
tdSql
.
checkData
(
2
,
0
,
None
)
print
(
dbresult
)
found
=
False
for
i
in
range
(
len
(
dbresult
)):
if
(
dbresult
[
i
][
0
]
==
"{
\"
location
\"
:
\"
beijing
\"
}"
):
found
=
True
break
assert
found
==
True
def
stop
(
self
):
def
stop
(
self
):
tdSql
.
close
()
tdSql
.
close
()
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeSmallInt.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -32,27 +30,34 @@ class TDTestCase:
...
@@ -32,27 +30,34 @@ class TDTestCase:
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
self
.
tmpdir
=
"tmp"
self
.
tmpdir
=
"tmp"
def
get
BuildPath
(
self
):
def
get
Path
(
self
,
tool
=
"taosdump"
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
paths
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosdump"
in
files
):
if
(
(
tool
)
in
files
):
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
rootRealPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
root
))
if
(
"packaging"
not
in
rootRealPath
):
if
(
"packaging"
not
in
rootRealPath
):
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
paths
.
append
(
os
.
path
.
join
(
root
,
tool
))
break
break
return
buildPath
if
(
len
(
paths
)
==
0
):
return
""
return
paths
[
0
]
def
run
(
self
):
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -69,14 +74,12 @@ class TDTestCase:
...
@@ -69,14 +74,12 @@ class TDTestCase:
tdSql
.
execute
(
"create table t4 using st tags(NULL)"
)
tdSql
.
execute
(
"create table t4 using st tags(NULL)"
)
tdSql
.
execute
(
"insert into t4 values(1640000000000, NULL)"
)
tdSql
.
execute
(
"insert into t4 values(1640000000000, NULL)"
)
# sys.exit(1)
binPath
=
self
.
getPath
()
if
(
binPath
==
""
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosdump not found!"
)
tdLog
.
exit
(
"taosdump not found!"
)
else
:
else
:
tdLog
.
info
(
"taosdump found
in %s"
%
build
Path
)
tdLog
.
info
(
"taosdump found
: %s"
%
bin
Path
)
binPath
=
buildPath
+
"/build/bin/"
if
not
os
.
path
.
exists
(
self
.
tmpdir
):
if
not
os
.
path
.
exists
(
self
.
tmpdir
):
os
.
makedirs
(
self
.
tmpdir
)
os
.
makedirs
(
self
.
tmpdir
)
...
@@ -86,16 +89,25 @@ class TDTestCase:
...
@@ -86,16 +89,25 @@ class TDTestCase:
os
.
makedirs
(
self
.
tmpdir
)
os
.
makedirs
(
self
.
tmpdir
)
os
.
system
(
os
.
system
(
"%s
taosdump
--databases db -o %s -T 1"
%
"%s --databases db -o %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
(
binPath
,
self
.
tmpdir
))
# sys.exit(1)
# sys.exit(1)
tdSql
.
execute
(
"drop database db"
)
tdSql
.
execute
(
"drop database db"
)
os
.
system
(
"%s
taosdump
-i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%s -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeTinyInt.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -37,8 +35,12 @@ class TDTestCase:
...
@@ -37,8 +35,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
if
(
"taosdump"
in
files
):
if
(
"taosdump"
in
files
):
...
@@ -52,7 +54,7 @@ class TDTestCase:
...
@@ -52,7 +54,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -95,7 +97,16 @@ class TDTestCase:
...
@@ -95,7 +97,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s -T 1"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeUnsignedBigInt.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -37,8 +35,12 @@ class TDTestCase:
...
@@ -37,8 +35,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
buildPath
=
""
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
@@ -53,7 +55,7 @@ class TDTestCase:
...
@@ -53,7 +55,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -91,7 +93,16 @@ class TDTestCase:
...
@@ -91,7 +93,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s -T 1 -g"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s -T 1 -g"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeUnsignedInt.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -37,8 +35,12 @@ class TDTestCase:
...
@@ -37,8 +35,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
buildPath
=
""
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
@@ -53,7 +55,7 @@ class TDTestCase:
...
@@ -53,7 +55,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -91,7 +93,16 @@ class TDTestCase:
...
@@ -91,7 +93,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s -T 1 -g"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s -T 1 -g"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeUnsignedSmallInt.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -37,8 +35,12 @@ class TDTestCase:
...
@@ -37,8 +35,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
buildPath
=
""
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
@@ -53,7 +55,7 @@ class TDTestCase:
...
@@ -53,7 +55,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -91,7 +93,16 @@ class TDTestCase:
...
@@ -91,7 +93,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s -T 1 -g"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s -T 1 -g"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
...
tests/develop-test/5-taos-tools/taosdump/taosdumpTestTypeUnsignedTinyInt.py
浏览文件 @
f81acb0a
...
@@ -11,13 +11,11 @@
...
@@ -11,13 +11,11 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
sys
import
os
import
os
from
util.log
import
*
from
util.log
import
*
from
util.cases
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.sql
import
*
from
util.dnodes
import
*
from
util.dnodes
import
*
import
subprocess
class
TDTestCase
:
class
TDTestCase
:
...
@@ -37,8 +35,12 @@ class TDTestCase:
...
@@ -37,8 +35,12 @@ class TDTestCase:
if
(
"community"
in
selfPath
):
if
(
"community"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
projPath
=
selfPath
[:
selfPath
.
find
(
"community"
)]
elif
(
"src"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"src"
)]
elif
(
"/tools/"
in
selfPath
):
projPath
=
selfPath
[:
selfPath
.
find
(
"/tools/"
)]
else
:
else
:
projPath
=
selfPath
[:
selfPath
.
find
(
"tests"
)]
tdLog
.
exit
(
"path: %s is not supported"
%
selfPath
)
buildPath
=
""
buildPath
=
""
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
for
root
,
dirs
,
files
in
os
.
walk
(
projPath
):
...
@@ -53,7 +55,7 @@ class TDTestCase:
...
@@ -53,7 +55,7 @@ class TDTestCase:
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database db
days 11 keep 3649 blocks 8
"
)
tdSql
.
execute
(
"create database db
keep 3649
"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
tdSql
.
execute
(
...
@@ -91,7 +93,16 @@ class TDTestCase:
...
@@ -91,7 +93,16 @@ class TDTestCase:
os
.
system
(
"%staosdump -i %s -T 1 -g"
%
(
binPath
,
self
.
tmpdir
))
os
.
system
(
"%staosdump -i %s -T 1 -g"
%
(
binPath
,
self
.
tmpdir
))
tdSql
.
query
(
"show databases"
)
tdSql
.
query
(
"show databases"
)
tdSql
.
checkRows
(
1
)
dbresult
=
tdSql
.
queryResult
found
=
False
for
i
in
range
(
len
(
dbresult
)):
print
(
"Found db: %s"
%
dbresult
[
i
][
0
])
if
(
dbresult
[
i
][
0
]
==
"db"
):
found
=
True
break
assert
found
==
True
tdSql
.
execute
(
"use db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"show stables"
)
tdSql
.
query
(
"show stables"
)
...
...
tests/parallel_test/cases.task
浏览文件 @
f81acb0a
...
@@ -831,4 +831,8 @@
...
@@ -831,4 +831,8 @@
1,,docs-examples-test, ./test_R.sh
1,,docs-examples-test, ./test_R.sh
1,,develop-test,python3 ./test.py -f 2-query/function_state.py
1,,develop-test,python3 ./test.py -f 2-query/function_state.py
1,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py
1,,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/demo.py
3,,develop-test,python3 ./test.py -f 5-taos-tools/taosdump/taosdumpTestBasic.py
3,,develop-test,python3 ./test.py -f 5-taos-tools/taosdump/taosdumpDbNtb.py
3,,develop-test,python3 ./test.py -f 5-taos-tools/taosdump/taosdumpDbStb.py
3,,develop-test,python3 ./test.py -f 5-taos-tools/taosdump/taosdumpManyCols.py
3,,develop-test,python3 ./test.py -f 5-taos-tools/taosdump/taosdumpTestInspect.py
3,,develop-test,python3 ./test.py -f 5-taos-tools/taosdump/taosdumpTestInspect.py
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录