Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
30065f30
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
30065f30
编写于
12月 26, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
12月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19109 from taosdata/enh/3.0_planner_optimize
enh: improve unit tests
上级
686a1a15
6a679eee
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
701 addition
and
263 deletion
+701
-263
source/libs/parser/test/parAlterToBalanceTest.cpp
source/libs/parser/test/parAlterToBalanceTest.cpp
+300
-141
source/libs/parser/test/parExplainToSyncdbTest.cpp
source/libs/parser/test/parExplainToSyncdbTest.cpp
+31
-3
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+332
-116
source/libs/parser/test/parInitialDTest.cpp
source/libs/parser/test/parInitialDTest.cpp
+38
-3
未找到文件。
source/libs/parser/test/parAlterToBalanceTest.cpp
浏览文件 @
30065f30
此差异已折叠。
点击以展开。
source/libs/parser/test/parExplainToSyncdbTest.cpp
浏览文件 @
30065f30
...
@@ -52,8 +52,8 @@ TEST_F(ParserExplainToSyncdbTest, grant) {
...
@@ -52,8 +52,8 @@ TEST_F(ParserExplainToSyncdbTest, grant) {
ASSERT_EQ
(
string
(
req
.
objname
),
string
(
expect
.
objname
));
ASSERT_EQ
(
string
(
req
.
objname
),
string
(
expect
.
objname
));
});
});
setAlterUserReq
(
TSDB_ALTER_USER_ADD_ALL_DB
,
"wxy"
,
"0.
test
"
);
setAlterUserReq
(
TSDB_ALTER_USER_ADD_ALL_DB
,
"wxy"
,
"0.
*
"
);
run
(
"GRANT ALL ON
test
.* TO wxy"
);
run
(
"GRANT ALL ON
*
.* TO wxy"
);
setAlterUserReq
(
TSDB_ALTER_USER_ADD_READ_DB
,
"wxy"
,
"0.test"
);
setAlterUserReq
(
TSDB_ALTER_USER_ADD_READ_DB
,
"wxy"
,
"0.test"
);
run
(
"GRANT READ ON test.* TO wxy"
);
run
(
"GRANT READ ON test.* TO wxy"
);
...
@@ -138,10 +138,38 @@ TEST_F(ParserExplainToSyncdbTest, redistributeVgroup) {
...
@@ -138,10 +138,38 @@ TEST_F(ParserExplainToSyncdbTest, redistributeVgroup) {
TEST_F
(
ParserExplainToSyncdbTest
,
revoke
)
{
TEST_F
(
ParserExplainToSyncdbTest
,
revoke
)
{
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
run
(
"REVOKE ALL ON test.* FROM wxy"
);
SAlterUserReq
expect
=
{
0
};
auto
setAlterUserReq
=
[
&
](
int8_t
alterType
,
const
string
&
user
,
const
string
&
obj
)
{
expect
.
alterType
=
alterType
;
snprintf
(
expect
.
user
,
sizeof
(
expect
.
user
),
"%s"
,
user
.
c_str
());
snprintf
(
expect
.
objname
,
sizeof
(
expect
.
objname
),
"%s"
,
obj
.
c_str
());
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_REVOKE_STMT
);
ASSERT_EQ
(
pQuery
->
pCmdMsg
->
msgType
,
TDMT_MND_ALTER_USER
);
SAlterUserReq
req
=
{
0
};
ASSERT_EQ
(
tDeserializeSAlterUserReq
(
pQuery
->
pCmdMsg
->
pMsg
,
pQuery
->
pCmdMsg
->
msgLen
,
&
req
),
TSDB_CODE_SUCCESS
);
ASSERT_EQ
(
req
.
alterType
,
expect
.
alterType
);
ASSERT_EQ
(
string
(
req
.
user
),
string
(
expect
.
user
));
ASSERT_EQ
(
string
(
req
.
objname
),
string
(
expect
.
objname
));
});
setAlterUserReq
(
TSDB_ALTER_USER_REMOVE_ALL_DB
,
"wxy"
,
"0.*"
);
run
(
"REVOKE ALL ON *.* FROM wxy"
);
setAlterUserReq
(
TSDB_ALTER_USER_REMOVE_READ_DB
,
"wxy"
,
"0.test"
);
run
(
"REVOKE READ ON test.* FROM wxy"
);
run
(
"REVOKE READ ON test.* FROM wxy"
);
setAlterUserReq
(
TSDB_ALTER_USER_REMOVE_WRITE_DB
,
"wxy"
,
"0.test"
);
run
(
"REVOKE WRITE ON test.* FROM wxy"
);
run
(
"REVOKE WRITE ON test.* FROM wxy"
);
setAlterUserReq
(
TSDB_ALTER_USER_REMOVE_ALL_DB
,
"wxy"
,
"0.test"
);
run
(
"REVOKE READ, WRITE ON test.* FROM wxy"
);
run
(
"REVOKE READ, WRITE ON test.* FROM wxy"
);
setAlterUserReq
(
TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC
,
"wxy"
,
"0.tp1"
);
run
(
"REVOKE SUBSCRIBE ON tp1 FROM wxy"
);
}
}
// todo syncdb
// todo syncdb
...
...
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
30065f30
此差异已折叠。
点击以展开。
source/libs/parser/test/parInitialDTest.cpp
浏览文件 @
30065f30
...
@@ -99,7 +99,7 @@ TEST_F(ParserInitialDTest, dropDnode) {
...
@@ -99,7 +99,7 @@ TEST_F(ParserInitialDTest, dropDnode) {
expect
.
force
=
force
;
expect
.
force
=
force
;
};
};
auto
setDropDnodeReqByEndpoint
=
[
&
](
const
char
*
pFqdn
,
int32_t
port
,
bool
force
=
false
)
{
auto
setDropDnodeReqByEndpoint
=
[
&
](
const
char
*
pFqdn
,
int32_t
port
=
tsServerPort
,
bool
force
=
false
)
{
strcpy
(
expect
.
fqdn
,
pFqdn
);
strcpy
(
expect
.
fqdn
,
pFqdn
);
expect
.
port
=
port
;
expect
.
port
=
port
;
expect
.
force
=
force
;
expect
.
force
=
force
;
...
@@ -131,6 +131,14 @@ TEST_F(ParserInitialDTest, dropDnode) {
...
@@ -131,6 +131,14 @@ TEST_F(ParserInitialDTest, dropDnode) {
setDropDnodeReqByEndpoint
(
"host2"
,
8030
,
true
);
setDropDnodeReqByEndpoint
(
"host2"
,
8030
,
true
);
run
(
"DROP DNODE 'host2:8030' FORCE"
);
run
(
"DROP DNODE 'host2:8030' FORCE"
);
clearDropDnodeReq
();
clearDropDnodeReq
();
setDropDnodeReqByEndpoint
(
"host1"
);
run
(
"DROP DNODE host1"
);
clearDropDnodeReq
();
setDropDnodeReqByEndpoint
(
"host2"
,
tsServerPort
,
true
);
run
(
"DROP DNODE host2 FORCE"
);
clearDropDnodeReq
();
}
}
// todo DROP function
// todo DROP function
...
@@ -174,7 +182,21 @@ TEST_F(ParserInitialDTest, dropMnode) {
...
@@ -174,7 +182,21 @@ TEST_F(ParserInitialDTest, dropMnode) {
TEST_F
(
ParserInitialDTest
,
dropQnode
)
{
TEST_F
(
ParserInitialDTest
,
dropQnode
)
{
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
run
(
"DROP qnode on dnode 1"
);
SMDropQnodeReq
expect
=
{
0
};
auto
setDropQnodeReq
=
[
&
](
int32_t
dnodeId
)
{
expect
.
dnodeId
=
dnodeId
;
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_DROP_QNODE_STMT
);
SMDropQnodeReq
req
=
{
0
};
ASSERT_TRUE
(
TSDB_CODE_SUCCESS
==
tDeserializeSCreateDropMQSNodeReq
(
pQuery
->
pCmdMsg
->
pMsg
,
pQuery
->
pCmdMsg
->
msgLen
,
&
req
));
ASSERT_EQ
(
req
.
dnodeId
,
expect
.
dnodeId
);
});
setDropQnodeReq
(
1
);
run
(
"DROP QNODE ON DNODE 1"
);
}
}
TEST_F
(
ParserInitialDTest
,
dropSnode
)
{
TEST_F
(
ParserInitialDTest
,
dropSnode
)
{
...
@@ -237,7 +259,20 @@ TEST_F(ParserInitialDTest, dropUser) {
...
@@ -237,7 +259,20 @@ TEST_F(ParserInitialDTest, dropUser) {
login
(
"root"
);
login
(
"root"
);
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
run
(
"DROP user wxy"
);
SDropUserReq
expect
=
{
0
};
auto
setDropUserReq
=
[
&
](
const
char
*
pUser
)
{
sprintf
(
expect
.
user
,
"%s"
,
pUser
);
};
setCheckDdlFunc
([
&
](
const
SQuery
*
pQuery
,
ParserStage
stage
)
{
ASSERT_EQ
(
nodeType
(
pQuery
->
pRoot
),
QUERY_NODE_DROP_USER_STMT
);
SDropUserReq
req
=
{
0
};
ASSERT_TRUE
(
TSDB_CODE_SUCCESS
==
tDeserializeSDropUserReq
(
pQuery
->
pCmdMsg
->
pMsg
,
pQuery
->
pCmdMsg
->
msgLen
,
&
req
));
ASSERT_EQ
(
std
::
string
(
req
.
user
),
std
::
string
(
expect
.
user
));
});
setDropUserReq
(
"wxy"
);
run
(
"DROP USER wxy"
);
}
}
}
// namespace ParserTest
}
// namespace ParserTest
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录