Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
38a67456
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看板
提交
38a67456
编写于
5月 28, 2022
作者:
J
jiajingbin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: add schemaless-insert 1-insert/opentsdb_telnet_line_taosc_insert.py to CI
上级
dadb0d47
变更
4
展开全部
显示空白变更内容
内联
并排
Showing
4 changed file
with
1653 addition
and
8 deletion
+1653
-8
tests/pytest/util/common.py
tests/pytest/util/common.py
+124
-8
tests/pytest/util/types.py
tests/pytest/util/types.py
+38
-0
tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
...system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
+1489
-0
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+2
-0
未找到文件。
tests/pytest/util/common.py
浏览文件 @
38a67456
...
...
@@ -14,23 +14,93 @@
import
random
import
string
from
util.sql
import
tdSql
from
util.dnodes
import
tdDnodes
import
requests
import
time
import
socket
class
TDCom
:
def
init
(
self
,
conn
,
logSql
):
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
cleanTb
(
self
):
def
preDefine
(
self
):
header
=
{
'Authorization'
:
'Basic cm9vdDp0YW9zZGF0YQ=='
}
sql_url
=
"http://127.0.0.1:6041/rest/sql"
sqlt_url
=
"http://127.0.0.1:6041/rest/sqlt"
sqlutc_url
=
"http://127.0.0.1:6041/rest/sqlutc"
influx_url
=
"http://127.0.0.1:6041/influxdb/v1/write"
telnet_url
=
"http://127.0.0.1:6041/opentsdb/v1/put/telnet"
return
header
,
sql_url
,
sqlt_url
,
sqlutc_url
,
influx_url
,
telnet_url
def
genTcpParam
(
self
):
MaxBytes
=
1024
*
1024
host
=
'127.0.0.1'
port
=
6046
return
MaxBytes
,
host
,
port
def
tcpClient
(
self
,
input
):
MaxBytes
=
tdCom
.
genTcpParam
()[
0
]
host
=
tdCom
.
genTcpParam
()[
1
]
port
=
tdCom
.
genTcpParam
()[
2
]
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
sock
.
connect
((
host
,
port
))
sock
.
send
(
input
.
encode
())
sock
.
close
()
def
restApiPost
(
self
,
sql
):
requests
.
post
(
self
.
preDefine
()[
1
],
sql
.
encode
(
"utf-8"
),
headers
=
self
.
preDefine
()[
0
])
def
createDb
(
self
,
dbname
=
"test"
,
db_update_tag
=
0
,
api_type
=
"taosc"
):
if
api_type
==
"taosc"
:
if
db_update_tag
==
0
:
tdSql
.
execute
(
f
"drop database if exists
{
dbname
}
"
)
tdSql
.
execute
(
f
"create database if not exists
{
dbname
}
precision 'us'"
)
else
:
tdSql
.
execute
(
f
"drop database if exists
{
dbname
}
"
)
tdSql
.
execute
(
f
"create database if not exists
{
dbname
}
precision 'us' update 1"
)
elif
api_type
==
"restful"
:
if
db_update_tag
==
0
:
self
.
restApiPost
(
f
"drop database if exists
{
dbname
}
"
)
self
.
restApiPost
(
f
"create database if not exists
{
dbname
}
precision 'us'"
)
else
:
self
.
restApiPost
(
f
"drop database if exists
{
dbname
}
"
)
self
.
restApiPost
(
f
"create database if not exists
{
dbname
}
precision 'us' update 1"
)
tdSql
.
execute
(
f
'use
{
dbname
}
'
)
def
genUrl
(
self
,
url_type
,
dbname
,
precision
):
if
url_type
==
"influxdb"
:
if
precision
is
None
:
url
=
self
.
preDefine
()[
4
]
+
"?"
+
"db="
+
dbname
else
:
url
=
self
.
preDefine
()[
4
]
+
"?"
+
"db="
+
dbname
+
"&precision="
+
precision
elif
url_type
==
"telnet"
:
url
=
self
.
preDefine
()[
5
]
+
"/"
+
dbname
else
:
url
=
self
.
preDefine
()[
1
]
return
url
def
schemalessApiPost
(
self
,
sql
,
url_type
=
"influxdb"
,
dbname
=
"test"
,
precision
=
None
):
if
url_type
==
"influxdb"
:
url
=
self
.
genUrl
(
url_type
,
dbname
,
precision
)
elif
url_type
==
"telnet"
:
url
=
self
.
genUrl
(
url_type
,
dbname
,
precision
)
res
=
requests
.
post
(
url
,
sql
.
encode
(
"utf-8"
),
headers
=
self
.
preDefine
()[
0
])
return
res
def
cleanTb
(
self
,
type
=
"taosc"
):
'''
type is taosc or restful
'''
query_sql
=
"show stables"
res_row_list
=
tdSql
.
query
(
query_sql
,
True
)
stb_list
=
map
(
lambda
x
:
x
[
0
],
res_row_list
)
for
stb
in
stb_list
:
if
type
==
"taosc"
:
tdSql
.
execute
(
f
'drop table if exists
{
stb
}
'
)
elif
type
==
"restful"
:
self
.
restApiPost
(
f
"drop table if exists
{
stb
}
"
)
query_sql
=
"show tables"
res_row_list
=
tdSql
.
query
(
query_sql
,
True
)
tb_list
=
map
(
lambda
x
:
x
[
0
],
res_row_list
)
for
tb
in
tb_list
:
tdSql
.
execute
(
f
'drop table if exists
{
tb
}
'
)
def
dateToTs
(
self
,
datetime_input
):
return
int
(
time
.
mktime
(
time
.
strptime
(
datetime_input
,
"%Y-%m-%d %H:%M:%S.%f"
)))
def
getLongName
(
self
,
len
,
mode
=
"mixed"
):
"""
...
...
@@ -47,6 +117,52 @@ class TDCom:
chars
=
''
.
join
(
random
.
choice
(
string
.
ascii_letters
.
lower
()
+
string
.
digits
)
for
i
in
range
(
len
))
return
chars
def
restartTaosd
(
self
,
index
=
1
,
db_name
=
"db"
):
tdDnodes
.
stop
(
index
)
tdDnodes
.
startWithoutSleep
(
index
)
tdSql
.
execute
(
f
"use
{
db_name
}
"
)
def
typeof
(
self
,
variate
):
v_type
=
None
if
type
(
variate
)
is
int
:
v_type
=
"int"
elif
type
(
variate
)
is
str
:
v_type
=
"str"
elif
type
(
variate
)
is
float
:
v_type
=
"float"
elif
type
(
variate
)
is
bool
:
v_type
=
"bool"
elif
type
(
variate
)
is
list
:
v_type
=
"list"
elif
type
(
variate
)
is
tuple
:
v_type
=
"tuple"
elif
type
(
variate
)
is
dict
:
v_type
=
"dict"
elif
type
(
variate
)
is
set
:
v_type
=
"set"
return
v_type
def
splitNumLetter
(
self
,
input_mix_str
):
nums
,
letters
=
""
,
""
for
i
in
input_mix_str
:
if
i
.
isdigit
():
nums
+=
i
elif
i
.
isspace
():
pass
else
:
letters
+=
i
return
nums
,
letters
def
smlPass
(
self
,
func
):
smlChildTableName
=
"no"
def
wrapper
(
*
args
):
# if tdSql.getVariable("smlChildTableName")[0].upper() == "ID":
if
smlChildTableName
.
upper
()
==
"ID"
:
return
func
(
*
args
)
else
:
pass
return
wrapper
def
close
(
self
):
self
.
cursor
.
close
()
...
...
tests/pytest/util/types.py
0 → 100644
浏览文件 @
38a67456
###################################################################
# 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 -*-
from
enum
import
Enum
class
TDSmlProtocolType
(
Enum
):
'''
Schemaless Protocol types
0 - unknown
1 - InfluxDB Line Protocol
2 - OpenTSDB Telnet Protocl
3 - OpenTSDB JSON Protocol
'''
UNKNOWN
=
0
LINE
=
1
TELNET
=
2
JSON
=
3
class
TDSmlTimestampType
(
Enum
):
NOT_CONFIGURED
=
0
HOUR
=
1
MINUTE
=
2
SECOND
=
3
MILLI_SECOND
=
4
MICRO_SECOND
=
5
NANO_SECOND
=
6
tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
0 → 100644
浏览文件 @
38a67456
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
浏览文件 @
38a67456
...
...
@@ -14,6 +14,8 @@ python3 ./test.py -f 0-others/udf_restart_taosd.py
python3 ./test.py
-f
0-others/user_control.py
python3 ./test.py
-f
0-others/fsync.py
python3 ./test.py
-f
1-insert/opentsdb_telnet_line_taosc_insert.py
python3 ./test.py
-f
2-query/between.py
python3 ./test.py
-f
2-query/distinct.py
python3 ./test.py
-f
2-query/varchar.py
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录