Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c4f14a4f
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看板
提交
c4f14a4f
编写于
7月 30, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix test cases
上级
c1c386bc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
30 deletion
+30
-30
tests/system-test/0-others/udfTest.py
tests/system-test/0-others/udfTest.py
+1
-1
tests/system-test/0-others/udf_cfg1.py
tests/system-test/0-others/udf_cfg1.py
+1
-1
tests/system-test/0-others/udf_cfg2.py
tests/system-test/0-others/udf_cfg2.py
+1
-1
tests/system-test/0-others/udf_cluster.py
tests/system-test/0-others/udf_cluster.py
+26
-26
tests/system-test/0-others/udf_create.py
tests/system-test/0-others/udf_create.py
+1
-1
未找到文件。
tests/system-test/0-others/udfTest.py
浏览文件 @
c4f14a4f
...
...
@@ -512,7 +512,7 @@ class TDTestCase:
"select c1,c2, udf1(c1,c2) from stb1 group by c1,c2"
,
"select num1,num2,num3,udf1(num1,num2,num3) from tb"
,
"select c1,c6,udf1(c1,c6) from stb1 order by ts"
,
"select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;"
"select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;"
]
udf2_sqls
=
[
"select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
,
"select udf2(c1) from stb1 group by 1-udf1(c1)"
,
...
...
tests/system-test/0-others/udf_cfg1.py
浏览文件 @
c4f14a4f
...
...
@@ -190,7 +190,7 @@ class TDTestCase:
tdSql
.
execute
(
"use db "
)
tdSql
.
error
(
"select num1 , udf1(num1) ,num2 ,udf1(num2),num3 ,udf1(num3),num4 ,udf1(num4) from tb"
)
tdSql
.
error
(
"select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1"
)
# aggregate functions
tdSql
.
error
(
"select udf2(num1) ,udf2(num2), udf2(num3) from tb"
)
...
...
tests/system-test/0-others/udf_cfg2.py
浏览文件 @
c4f14a4f
...
...
@@ -514,7 +514,7 @@ class TDTestCase:
"select c1,c2, udf1(c1,c2) from stb1 group by c1,c2"
,
"select num1,num2,num3,udf1(num1,num2,num3) from tb"
,
"select c1,c6,udf1(c1,c6) from stb1 order by ts"
,
"select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;"
"select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;"
]
udf2_sqls
=
[
"select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
,
"select udf2(c1) from stb1 group by 1-udf1(c1)"
,
...
...
tests/system-test/0-others/udf_cluster.py
浏览文件 @
c4f14a4f
import
taos
import
sys
import
time
import
os
import
os
from
util.log
import
*
from
util.sql
import
*
...
...
@@ -16,7 +16,7 @@ class MyDnodes(TDDnodes):
super
(
MyDnodes
,
self
).
__init__
()
self
.
dnodes
=
dnodes_lists
# dnode must be TDDnode instance
self
.
simDeployed
=
False
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
...
...
@@ -26,7 +26,7 @@ class TDTestCase:
self
.
master_dnode
=
self
.
TDDnodes
.
dnodes
[
0
]
conn1
=
taos
.
connect
(
self
.
master_dnode
.
cfgDict
[
"fqdn"
]
,
config
=
self
.
master_dnode
.
cfgDir
)
tdSql
.
init
(
conn1
.
cursor
())
def
getBuildPath
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
...
@@ -43,7 +43,7 @@ class TDTestCase:
buildPath
=
root
[:
len
(
root
)
-
len
(
"/build/bin"
)]
break
return
buildPath
def
prepare_udf_so
(
self
):
selfPath
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
...
@@ -61,7 +61,7 @@ class TDTestCase:
def
prepare_data
(
self
):
tdSql
.
execute
(
"drop database if exists db"
)
tdSql
.
execute
(
"create database if not exists db replica 1 duration 300"
)
tdSql
.
execute
(
"use db"
)
...
...
@@ -71,7 +71,7 @@ class TDTestCase:
tags (t1 int)
'''
)
tdSql
.
execute
(
'''
create table t1
...
...
@@ -142,7 +142,7 @@ class TDTestCase:
# create aggregate functions
tdSql
.
execute
(
"create aggregate function udf2 as '/tmp/udf/libudf2.so' outputtype double bufSize 8;"
)
# functions = tdSql.getResult("show functions")
# function_nums = len(functions)
# if function_nums == 2:
...
...
@@ -167,14 +167,14 @@ class TDTestCase:
# create aggregate functions
tdSql
.
execute
(
"create aggregate function udf2 as '/tmp/udf/libudf2.so' outputtype double bufSize 8;"
)
functions
=
tdSql
.
getResult
(
"show functions"
)
function_nums
=
len
(
functions
)
if
function_nums
==
2
:
tdLog
.
info
(
"create two udf functions success "
)
def
basic_udf_query
(
self
,
dnode
):
mytdSql
=
self
.
getConnection
(
dnode
)
# scalar functions
...
...
@@ -229,7 +229,7 @@ class TDTestCase:
else
:
tdLog
.
info
(
" UDF query check failed at :dnode_index %s"
%
dnode
.
index
)
tdLog
.
exit
(
"query check failed at :dnode_index %s"
%
dnode
.
index
)
def
check_UDF_query
(
self
):
...
...
@@ -238,10 +238,10 @@ class TDTestCase:
self
.
basic_udf_query
(
dnode
)
def
depoly_cluster
(
self
,
dnodes_nums
):
def
depoly_cluster
(
self
,
dnodes_nums
):
testCluster
=
False
valgrind
=
0
valgrind
=
0
hostname
=
socket
.
gethostname
()
dnodes
=
[]
start_port
=
6030
...
...
@@ -253,7 +253,7 @@ class TDTestCase:
dnode
.
addExtraCfg
(
"monitorFqdn"
,
hostname
)
dnode
.
addExtraCfg
(
"monitorPort"
,
7043
)
dnodes
.
append
(
dnode
)
self
.
TDDnodes
=
MyDnodes
(
dnodes
)
self
.
TDDnodes
.
init
(
""
)
self
.
TDDnodes
.
setTestCluster
(
testCluster
)
...
...
@@ -261,11 +261,11 @@ class TDTestCase:
self
.
TDDnodes
.
stopAll
()
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
deploy
(
dnode
.
index
,{})
for
dnode
in
self
.
TDDnodes
.
dnodes
:
self
.
TDDnodes
.
start
(
dnode
.
index
)
# create cluster
# create cluster
for
dnode
in
self
.
TDDnodes
.
dnodes
:
print
(
dnode
.
cfgDict
)
...
...
@@ -275,12 +275,12 @@ class TDTestCase:
cmd
=
f
" taos -h
{
dnode_first_host
}
-P
{
dnode_first_port
}
-s ' create dnode
\"
{
dnode_id
}
\"
' ;"
print
(
cmd
)
os
.
system
(
cmd
)
time
.
sleep
(
2
)
tdLog
.
info
(
" create cluster done! "
)
def
getConnection
(
self
,
dnode
):
host
=
dnode
.
cfgDict
[
"fqdn"
]
port
=
dnode
.
cfgDict
[
"serverPort"
]
...
...
@@ -288,23 +288,23 @@ class TDTestCase:
return
taos
.
connect
(
host
=
host
,
port
=
int
(
port
),
config
=
config_dir
)
def
restart_udfd
(
self
,
dnode
):
buildPath
=
self
.
getBuildPath
()
if
(
buildPath
==
""
):
tdLog
.
exit
(
"taosd not found!"
)
else
:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
cfgPath
=
dnode
.
cfgDir
udfdPath
=
buildPath
+
'/build/bin/udfd'
for
i
in
range
(
5
):
tdLog
.
info
(
" loop restart udfd %d_th at dnode_index : %s"
%
(
i
,
dnode
.
index
))
self
.
basic_udf_query
(
dnode
)
# stop udfd cmds
# stop udfd cmds
get_processID
=
"ps -ef | grep -w udfd | grep %s | grep 'root' | grep -v grep| grep -v defunct | awk '{print $2}'"
%
cfgPath
processID
=
subprocess
.
check_output
(
get_processID
,
shell
=
True
).
decode
(
"utf-8"
)
stop_udfd
=
" kill -9 %s"
%
processID
...
...
@@ -327,12 +327,12 @@ class TDTestCase:
# self.check_UDF_query()
self
.
restart_udfd
(
self
.
master_dnode
)
# self.test_restart_udfd_All_dnodes()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
\ No newline at end of file
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tests/system-test/0-others/udf_create.py
浏览文件 @
c4f14a4f
...
...
@@ -514,7 +514,7 @@ class TDTestCase:
"select c1,c2, udf1(c1,c2) from stb1 group by c1,c2"
,
"select num1,num2,num3,udf1(num1,num2,num3) from tb"
,
"select c1,c6,udf1(c1,c6) from stb1 order by ts"
,
"select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;"
"select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;"
]
udf2_sqls
=
[
"select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null"
,
"select udf2(c1) from stb1 group by 1-udf1(c1)"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录