test: reopen userTest
This commit is contained in:
parent
de12192807
commit
1e73923c4d
|
@ -1,11 +1,11 @@
|
||||||
aux_source_directory(. USER_SRC)
|
aux_source_directory(. MNODE_USER_TEST_SRC)
|
||||||
add_executable(mnode_test_user ${USER_SRC})
|
add_executable(userTest ${MNODE_USER_TEST_SRC})
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
mnode_test_user
|
userTest
|
||||||
PUBLIC sut
|
PUBLIC sut
|
||||||
)
|
)
|
||||||
|
|
||||||
add_test(
|
add_test(
|
||||||
NAME mnode_test_user
|
NAME userTest
|
||||||
COMMAND mnode_test_user
|
COMMAND userTest
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,21 +26,8 @@ class MndTestUser : public ::testing::Test {
|
||||||
Testbase MndTestUser::test;
|
Testbase MndTestUser::test;
|
||||||
|
|
||||||
TEST_F(MndTestUser, 01_Show_User) {
|
TEST_F(MndTestUser, 01_Show_User) {
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
CHECK_META("show users", 4);
|
|
||||||
|
|
||||||
CHECK_SCHEMA(0, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "name");
|
|
||||||
CHECK_SCHEMA(1, TSDB_DATA_TYPE_BINARY, 10 + VARSTR_HEADER_SIZE, "privilege");
|
|
||||||
CHECK_SCHEMA(2, TSDB_DATA_TYPE_TIMESTAMP, 8, "create_time");
|
|
||||||
CHECK_SCHEMA(3, TSDB_DATA_TYPE_BINARY, TSDB_USER_LEN + VARSTR_HEADER_SIZE, "account");
|
|
||||||
|
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 1);
|
EXPECT_EQ(test.GetShowRows(), 1);
|
||||||
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("super", 10);
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(MndTestUser, 02_Create_User) {
|
TEST_F(MndTestUser, 02_Create_User) {
|
||||||
|
@ -99,18 +86,8 @@ TEST_F(MndTestUser, 02_Create_User) {
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
|
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 2);
|
EXPECT_EQ(test.GetShowRows(), 2);
|
||||||
|
|
||||||
CheckBinary("u1", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("normal", 10);
|
|
||||||
CheckBinary("super", 10);
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -125,8 +102,7 @@ TEST_F(MndTestUser, 02_Create_User) {
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
|
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 1);
|
EXPECT_EQ(test.GetShowRows(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,18 +120,8 @@ TEST_F(MndTestUser, 02_Create_User) {
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
|
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 2);
|
EXPECT_EQ(test.GetShowRows(), 2);
|
||||||
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("u2", TSDB_USER_LEN);
|
|
||||||
CheckBinary("super", 10);
|
|
||||||
CheckBinary("super", 10);
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -170,8 +136,7 @@ TEST_F(MndTestUser, 02_Create_User) {
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
|
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 1);
|
EXPECT_EQ(test.GetShowRows(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,8 +156,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
|
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 2);
|
EXPECT_EQ(test.GetShowRows(), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,8 +401,7 @@ TEST_F(MndTestUser, 03_Alter_User) {
|
||||||
ASSERT_NE(pRsp, nullptr);
|
ASSERT_NE(pRsp, nullptr);
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
|
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 1);
|
EXPECT_EQ(test.GetShowRows(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -497,10 +460,7 @@ TEST_F(MndTestUser, 05_Drop_User) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
CHECK_META("show users", 4);
|
|
||||||
|
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 1);
|
EXPECT_EQ(test.GetShowRows(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,25 +493,9 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
CHECK_META("show users", 4);
|
|
||||||
|
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 3);
|
EXPECT_EQ(test.GetShowRows(), 3);
|
||||||
|
|
||||||
CheckBinary("u1", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("u2", TSDB_USER_LEN);
|
|
||||||
CheckBinary("normal", 10);
|
|
||||||
CheckBinary("super", 10);
|
|
||||||
CheckBinary("normal", 10);
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
SAlterUserReq alterReq = {0};
|
SAlterUserReq alterReq = {0};
|
||||||
alterReq.alterType = TSDB_ALTER_USER_PASSWD;
|
alterReq.alterType = TSDB_ALTER_USER_PASSWD;
|
||||||
|
@ -567,25 +511,8 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
CHECK_META("show users", 4);
|
|
||||||
|
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 3);
|
EXPECT_EQ(test.GetShowRows(), 3);
|
||||||
|
|
||||||
CheckBinary("u1", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("u2", TSDB_USER_LEN);
|
|
||||||
CheckBinary("normal", 10);
|
|
||||||
CheckBinary("super", 10);
|
|
||||||
CheckBinary("normal", 10);
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
SDropUserReq dropReq = {0};
|
SDropUserReq dropReq = {0};
|
||||||
strcpy(dropReq.user, "u1");
|
strcpy(dropReq.user, "u1");
|
||||||
|
@ -599,37 +526,13 @@ TEST_F(MndTestUser, 06_Create_Drop_Alter_User) {
|
||||||
ASSERT_EQ(pRsp->code, 0);
|
ASSERT_EQ(pRsp->code, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
CHECK_META("show users", 4);
|
|
||||||
|
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 2);
|
EXPECT_EQ(test.GetShowRows(), 2);
|
||||||
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("u2", TSDB_USER_LEN);
|
|
||||||
CheckBinary("super", 10);
|
|
||||||
CheckBinary("normal", 10);
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
|
|
||||||
// restart
|
// restart
|
||||||
test.Restart();
|
test.Restart();
|
||||||
|
|
||||||
taosMsleep(1000);
|
taosMsleep(1000);
|
||||||
test.SendShowMetaReq(TSDB_MGMT_TABLE_USER, "");
|
test.SendShowReq(TSDB_MGMT_TABLE_USER, "user_users", "");
|
||||||
CHECK_META("show users", 4);
|
|
||||||
|
|
||||||
test.SendShowRetrieveReq();
|
|
||||||
EXPECT_EQ(test.GetShowRows(), 2);
|
EXPECT_EQ(test.GetShowRows(), 2);
|
||||||
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("u2", TSDB_USER_LEN);
|
|
||||||
CheckBinary("super", 10);
|
|
||||||
CheckBinary("normal", 10);
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckTimestamp();
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
CheckBinary("root", TSDB_USER_LEN);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue