Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bce18ee8
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看板
提交
bce18ee8
编写于
9月 27, 2021
作者:
P
Ping Xiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TS-376]<test>: add test case
上级
c976aeb2
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
85 addition
and
46 deletion
+85
-46
tests/connectorTest/C#Test/nanosupport/nanotest.cs
tests/connectorTest/C#Test/nanosupport/nanotest.cs
+13
-46
tests/pytest/insert/schemaChangeTest.py
tests/pytest/insert/schemaChangeTest.py
+72
-0
未找到文件。
tests/connectorTest/C#Test/nanosupport/nanotest.cs
浏览文件 @
bce18ee8
...
...
@@ -29,21 +29,7 @@ namespace TDengineDriver
private
string
password
=
"taosdata"
;
private
short
port
=
0
;
//sql parameters
private
string
dbName
;
private
string
tbName
;
private
string
precision
;
private
bool
isInsertData
;
private
bool
isQueryData
;
private
long
tableCount
;
private
long
totalRows
;
private
long
batchRows
;
private
long
beginTimestamp
=
1551369600000L
;
private
IntPtr
conn
=
IntPtr
.
Zero
;
private
long
rowsInserted
=
0
;
static
void
Main
(
string
[]
args
)
{
...
...
@@ -73,15 +59,6 @@ namespace TDengineDriver
tester
.
executeQuery
(
"select * from tb;"
);
// Console.WriteLine("expected is : {0}", width);
// tdSql.checkData(0,0,"2021-06-10 0:00:00.100000001");
// tdSql.checkData(1,0,"2021-06-10 0:00:00.150000000");
// tdSql.checkData(2,0,"2021-06-10 0:00:00.299999999");
// tdSql.checkData(3,1,3);
// tdSql.checkData(4,1,5);
// tdSql.checkData(5,1,7);
// tdSql.checkRows(6);
tester
.
executeQuery
(
"select count(*) from tb where ts > 1623254400100000000 and ts < 1623254400100000002;"
);
Console
.
WriteLine
(
"expected is : 1 "
);
tester
.
executeQuery
(
"select count(*) from tb where ts > '2021-06-10 0:00:00.100000001' and ts < '2021-06-10 0:00:00.160000000';"
);
...
...
@@ -271,8 +248,8 @@ namespace TDengineDriver
// tdSql.checkData(0,0,1623258000123456789);
Console
.
WriteLine
(
"usdb"
);
tester
.
execute
(
"drop database if exists usdb;"
);
tester
.
execute
(
"create database usdb precision 'us';"
);
tester
.
execute
(
"use usdb;"
);
tester
.
execute
(
"create stable st (ts timestamp ,speed float ) tags(time timestamp ,id int);"
);
...
...
@@ -290,12 +267,8 @@ namespace TDengineDriver
tester
.
executeQuery
(
"select first(*) from tb1;"
);
Console
.
WriteLine
(
"expected is : 1623258000123 "
);
tester
.
CloseConnection
();
tester
.
cleanup
();
}
public
void
InitTDengine
()
...
...
@@ -321,13 +294,13 @@ namespace TDengineDriver
Console
.
WriteLine
(
"[ OK ] Connection established."
);
}
}
//EXECUTE SQL
public
void
execute
(
string
sql
)
{
DateTime
dt1
=
DateTime
.
Now
;
IntPtr
res
=
TDengine
.
Query
(
this
.
conn
,
sql
.
ToString
());
DateTime
dt2
=
DateTime
.
Now
;
TimeSpan
span
=
dt2
-
dt1
;
if
((
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
))
{
...
...
@@ -481,22 +454,16 @@ namespace TDengineDriver
switch
(
psc
)
{
case
0
:
Console
.
WriteLine
(
"db:[{0:G}]'s precision is {1:G}
"
,
this
.
dbName
,
"
millisecond"
);
Console
.
WriteLine
(
"db:[{0:G}]'s precision is {1:G}
millisecond"
);
break
;
case
1
:
Console
.
WriteLine
(
"db:[{0:G}]'s precision is {1:G}
"
,
this
.
dbName
,
"
microsecond"
);
Console
.
WriteLine
(
"db:[{0:G}]'s precision is {1:G}
microsecond"
);
break
;
case
2
:
Console
.
WriteLine
(
"db:[{0:G}]'s precision is {1:G}
"
,
this
.
dbName
,
"
nanosecond"
);
Console
.
WriteLine
(
"db:[{0:G}]'s precision is {1:G}
nanosecond"
);
break
;
}
}
// public void checkData(int x ,int y , long ts ){
// }
}
}
tests/pytest/insert/schemaChangeTest.py
0 → 100644
浏览文件 @
bce18ee8
###################################################################
# 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
*
import
multiprocessing
as
mp
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
ts
=
1609430400000
def
alterTableSchema
(
self
):
conn1
=
taos
.
connect
(
host
=
"127.0.0.1"
,
user
=
"root"
,
password
=
"taosdata"
,
config
=
tdDnodes
.
getSimCfgPath
())
c1
=
conn1
.
cursor
()
c1
.
execute
(
"use db"
)
c1
.
execute
(
"alter table st drop column c2"
)
c1
.
execute
(
"alter table st add column c2 double"
)
tdLog
.
sleep
(
1
)
c1
.
execute
(
"select * from st"
)
for
data
in
c1
:
print
(
"Process 1: c2 = %s"
%
data
[
2
])
def
insertData
(
self
):
conn2
=
taos
.
connect
(
host
=
"127.0.0.1"
,
user
=
"root"
,
password
=
"taosdata"
,
config
=
tdDnodes
.
getSimCfgPath
())
c2
=
conn2
.
cursor
()
tdLog
.
sleep
(
1
)
c2
.
execute
(
"use db"
)
c2
.
execute
(
"insert into t1 values(%d, 2, 2.22)"
%
(
self
.
ts
+
1
))
c2
.
execute
(
"select * from st"
)
for
data
in
c2
:
print
(
"Process 2: c2 = %f"
%
data
[
2
])
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
"create table st(ts timestamp, c1 int, c2 float) tags(t1 int)"
)
tdSql
.
execute
(
"create table t1 using st tags(1)"
)
tdSql
.
execute
(
"insert into t1 values(%d, 1, 1.11)"
%
self
.
ts
)
p1
=
mp
.
Process
(
target
=
self
.
alterTableSchema
,
args
=
())
p2
=
mp
.
Process
(
target
=
self
.
insertData
,
args
=
())
p1
.
start
()
p2
.
start
()
p1
.
join
()
p2
.
join
()
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录