Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1eb792a8
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看板
提交
1eb792a8
编写于
3月 08, 2022
作者:
haoranc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-13526]<test>: add checkClusterStatus.py
上级
058cec47
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
111 addition
and
0 deletion
+111
-0
tests/pytest/manualTest/TD-5114/checkClusterStatus.py
tests/pytest/manualTest/TD-5114/checkClusterStatus.py
+111
-0
未找到文件。
tests/pytest/manualTest/TD-5114/checkClusterStatus.py
0 → 100644
浏览文件 @
1eb792a8
###################################################################
# 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
import
sys
sys
.
path
.
insert
(
0
,
os
.
getcwd
())
from
util.log
import
*
from
util.sql
import
*
from
util.dnodes
import
*
import
taos
import
threading
import
subprocess
import
datetime
from
random
import
choice
class
TwoClients
:
def
initConnection
(
self
):
self
.
host
=
sys
.
argv
[
1
]
self
.
user
=
"root"
self
.
password
=
"taosdata"
self
.
config
=
"/etc/taos/"
self
.
port
=
6030
self
.
rowNum
=
10
self
.
ts
=
1537146000000
def
run
(
self
):
# new taos client
conn1
=
taos
.
connect
(
host
=
self
.
host
,
user
=
self
.
user
,
password
=
self
.
password
,
config
=
self
.
config
)
cur1
=
conn1
.
cursor
()
print
(
cur1
)
tdSql
.
init
(
cur1
,
True
)
# insert data with python connector , if you want to use this case ,cancel note.
# check cluster status
tdSql
.
query
(
"show dnodes"
)
print
(
tdSql
.
queryRows
)
for
i
in
range
(
tdSql
.
queryRows
):
for
j
in
range
(
1
,
tdSql
.
queryRows
+
1
):
if
(
tdSql
.
queryResult
[
i
][
1
]
==
"compat_container%d:6030"
%
j
):
tdSql
.
checkData
(
i
,
4
,
"ready"
)
tdSql
.
query
(
"show mnodes"
)
tdSql
.
checkRows
(
3
)
roles
=
"master slave"
for
i
in
range
(
tdSql
.
queryRows
):
if
(
tdSql
.
queryResult
[
i
][
2
]
in
roles
):
ep
=
tdSql
.
queryResult
[
i
][
1
]
role
=
tdSql
.
queryResult
[
i
][
2
]
print
(
" the role of %s is %s "
%
(
ep
,
role
))
else
:
print
(
"cluster is not ready"
)
version
=
sys
.
argv
[
2
]
tdSql
.
query
(
"show variables"
)
tdSql
.
checkData
(
6
,
1
,
"%s"
%
version
)
# for x in range(10):
dataType
=
[
"tinyint"
,
"smallint"
,
"int"
,
"bigint"
,
"float"
,
"double"
,
"bool"
,
" binary(20)"
,
"nchar(20)"
,
"tinyint unsigned"
,
"smallint unsigned"
,
"int unsigned"
,
"bigint unsigned"
]
tdSql
.
execute
(
"drop database if exists db1"
)
tdSql
.
execute
(
"create database db1 keep 3650 replica 2 "
)
tdSql
.
execute
(
"use db1"
)
tdSql
.
execute
(
'''create table test(ts timestamp, col0 tinyint, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col10 tinyint unsigned, col11 smallint unsigned, col12 int unsigned, col13 bigint unsigned) tags(loc nchar(3000), tag1 int)'''
)
print
(
datetime
.
datetime
.
now
())
rowNum1
=
20
for
i
in
range
(
rowNum1
):
tdSql
.
execute
(
"alter table test add column col%d %s ;"
%
(
i
+
14
,
choice
(
dataType
))
)
rowNum2
=
20
for
i
in
range
(
rowNum2
):
tdSql
.
execute
(
"alter table test drop column col%d ;"
%
(
i
+
14
)
)
self
.
rowNum3
=
50
self
.
rowNum4
=
100
self
.
ts
=
1537146000000
for
j
in
range
(
self
.
rowNum4
):
tdSql
.
execute
(
"create table test%d using test tags('beijing%d', 10)"
%
(
j
,
j
)
)
for
i
in
range
(
self
.
rowNum3
):
tdSql
.
execute
(
"insert into test%d values(%d, %d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
%
(
j
,
self
.
ts
+
i
*
1000
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
0.1
,
i
+
0.1
,
i
%
2
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
,
i
+
1
))
print
(
datetime
.
datetime
.
now
())
# check data correct
tdSql
.
execute
(
"show databases"
)
tdSql
.
execute
(
"use db1"
)
tdSql
.
query
(
"select count (tbname) from test"
)
tdSql
.
checkData
(
0
,
0
,
100
)
tdSql
.
query
(
"select count (*) from test"
)
tdSql
.
checkData
(
0
,
0
,
5000
)
# delete useless file
testcaseFilename
=
os
.
path
.
split
(
__file__
)[
-
1
]
os
.
system
(
"rm -rf ./insert_res.txt"
)
os
.
system
(
"rm -rf manualTest/TD-5114/%s.sql"
%
testcaseFilename
)
clients
=
TwoClients
()
clients
.
initConnection
()
# clients.getBuildPath()
clients
.
run
()
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录