Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
517f3ee5
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看板
提交
517f3ee5
编写于
10月 31, 2022
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add audit db test cases
上级
1d419357
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
224 addition
and
1 deletion
+224
-1
tests/system-test/0-others/audit.py
tests/system-test/0-others/audit.py
+222
-0
tests/system-test/fulltest-others.sh
tests/system-test/fulltest-others.sh
+2
-1
未找到文件。
tests/system-test/0-others/audit.py
0 → 100644
浏览文件 @
517f3ee5
###################################################################
# 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
import
time
import
os
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
class
TDTestCase
:
def
caseDescription
(
self
):
'''
TS-1887 Create Audit db for DDL storage
'''
return
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
now
=
time
.
time
()
self
.
ts
=
int
(
round
(
now
*
1000
))
def
run
(
self
):
#tdSql.prepare()
time
.
sleep
(
3
)
print
(
"==============step1 test CREATE DDL"
)
# CREATE DATABASE
tdSql
.
execute
(
"create database db"
)
tdSql
.
execute
(
"use db"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'CREATE DATABASE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# CREATE NORMAL TABLE
tdSql
.
execute
(
"create table tb (ts timestamp, c0 int)"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'CREATE TABLE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.tb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# CREATE SUPER TABLE
tdSql
.
execute
(
"create table stb (ts timestamp, c0 int) tags (t0 int)"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'CREATE SUPER TABLE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.stb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# CREATE CHILD TABLE
tdSql
.
execute
(
"create table ctb using stb tags (1)"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'CREATE CHILD TABLE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.ctb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# CREATE CHILD TABLE(AUTO)
tdSql
.
execute
(
"insert into ctb_auto using stb tags (2) values (now, 2)"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'CREATE CHILD TABLE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.ctb_auto'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
print
(
"==============step2 test ALTER DDL"
)
# ALTER ATABASE
tdSql
.
execute
(
"alter database db keep 354"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'ALTER DATABASE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
tdSql
.
execute
(
"alter database db cachelast 1"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'ALTER DATABASE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# ADD COLUMN NORMAL TABLE
tdSql
.
execute
(
"alter table tb add column c1 binary(4)"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'ADD COLUMN'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.tb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# MODIFY COLUMN NORMAL TABLE
tdSql
.
execute
(
"alter table tb modify column c1 binary(10)"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'MODIFY COLUMN/TAG LENGTH'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.tb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# ADD COLUMN SUPER TABLE
tdSql
.
execute
(
"alter table stb add column c1 binary(4)"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'ADD COLUMN'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.stb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# ADD TAG SUPER TABLE
tdSql
.
execute
(
"alter table stb add tag t1 binary(4)"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'ADD TAG'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.stb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# MODIFY COLUMN SUPER TABLE
tdSql
.
execute
(
"alter table stb modify column c1 binary(10)"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'MODIFY COLUMN/TAG LENGTH'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.stb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# MODIFY TAG SUPER TABLE
tdSql
.
execute
(
"alter table stb modify tag t1 binary(10)"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'MODIFY COLUMN/TAG LENGTH'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.stb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# CHANGE TAG NAME SUPER TABLE
tdSql
.
execute
(
"alter table stb change tag t1 t2"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'CHANGE TAG NAME'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.stb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
print
(
"==============step3 test DROP DDL"
)
# DROP COLUMN NORMAL TABLE
tdSql
.
execute
(
"alter table tb drop column c1"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'DROP COLUMN'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.tb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# DROP COLUMN SUPER TABLE
tdSql
.
execute
(
"alter table stb drop column c1"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'DROP COLUMN'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.stb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# DROP TAG SUPER TABLE
tdSql
.
execute
(
"alter table stb drop tag t2"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'DROP TAG'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.stb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# DROP NORMAL TABLE
tdSql
.
execute
(
"drop table tb"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'DROP TABLE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.tb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# DROP CHILD TABLE
tdSql
.
execute
(
"drop table ctb"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'DROP CHILD TABLE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.ctb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# DROP SUPER TABLE
tdSql
.
execute
(
"drop table stb"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'DROP SUPER TABLE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db.stb'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
# DROP DATABASE
tdSql
.
execute
(
"drop database db"
)
tdSql
.
query
(
"select last(*) from audit.ddl"
);
tdSql
.
checkData
(
0
,
3
,
'DROP DATABASE'
)
tdSql
.
checkData
(
0
,
4
,
'0.db'
)
tdSql
.
checkData
(
0
,
5
,
'success'
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/fulltest-others.sh
浏览文件 @
517f3ee5
python3 ./test.py
-f
0-others/create_col_tag.py
\ No newline at end of file
python3 ./test.py
-f
0-others/create_col_tag.py
python3 ./test.py
-f
0-others/audit.py
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录