Skip to content

Commit

Permalink
cr: check kqp error message
Browse files Browse the repository at this point in the history
  • Loading branch information
kunga committed Jan 8, 2025
1 parent fb53fdc commit 3adffbd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
26 changes: 26 additions & 0 deletions ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4066,6 +4066,32 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
auto result = session.ExecuteSchemeQuery(query).GetValueSync();
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
}
{
// Drop user with ACL
auto session = db.CreateSession().GetValueSync().GetSession();

TString query = TStringBuilder() << R"(
--!syntax_v1
CREATE USER user2 PASSWORD NULL;
)";
auto result = session.ExecuteSchemeQuery(query).GetValueSync();
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());

query = TStringBuilder() << R"(
--!syntax_v1
GRANT ALL ON `/Root` TO user2;
)";
result = session.ExecuteSchemeQuery(query).GetValueSync();
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());

query = TStringBuilder() << R"(
--!syntax_v1
DROP USER user2;
)";
result = session.ExecuteSchemeQuery(query).GetValueSync();
UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), EStatus::PRECONDITION_FAILED);
UNIT_ASSERT_STRING_CONTAINS(result.GetIssues().ToString(), "Error: User user2 has an ACL record on /Root and can't be removed");
}
}

Y_UNIT_TEST(AlterUser) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class TAlterLogin: public TSubOperationBase {
if (acl.HasAccess(user)) {
auto pathStr = TPath::Init(pathId, context.SS).PathString();
return {.Error = TStringBuilder() <<
"User " << user << " has ACL record on " << pathStr << " and can't be removed"};
"User " << user << " has an ACL record on " << pathStr << " and can't be removed"};
}
}

Expand Down
2 changes: 1 addition & 1 deletion ydb/core/tx/schemeshard/ut_login/ut_login.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardLoginTest) {
// Cerr << DescribePath(runtime, TTestTxConfig::SchemeShard, "/MyRoot/Dir1").DebugString() << Endl;

CreateAlterLoginRemoveUser(runtime, ++txId, "/MyRoot", "user1",
TVector<TExpectedResult>{{NKikimrScheme::StatusPreconditionFailed, "User user1 has ACL record on /MyRoot/Dir1 and can't be removed"}});
TVector<TExpectedResult>{{NKikimrScheme::StatusPreconditionFailed, "User user1 has an ACL record on /MyRoot/Dir1 and can't be removed"}});

// check user still exists and has their rights:
{
Expand Down

0 comments on commit 3adffbd

Please sign in to comment.