Skip to content

Commit a861465

Browse files
azevaykinGazizonoki
authored andcommitted
Moved commit "Testlib: CheckDatabaseAccessPermission = true" from ydb repo
1 parent 85f1ffd commit a861465

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/client/topic/ut/describe_topic_ut.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ namespace NYdb::NTopic::NTests {
366366
Cerr << std::format("=== existingTopic={} allowUpdateRow={} allowDescribeSchema={} authToken={}\n",
367367
existingTopic, allowUpdateRow, allowDescribeSchema, std::string(authToken));
368368

369+
setup.GetServer().AnnoyingClient->GrantConnect(authToken);
370+
369371
auto driverConfig = setup.MakeDriverConfig().SetAuthToken(authToken);
370372
auto client = TTopicClient(TDriver(driverConfig));
371373
auto settings = TDescribePartitionSettings().IncludeLocation(true);
@@ -380,7 +382,14 @@ namespace NYdb::NTopic::NTests {
380382
}
381383
setup.GetServer().AnnoyingClient->ModifyACL("/Root", TString{TEST_TOPIC}, acl.SerializeAsString());
382384

383-
return client.DescribePartition(existingTopic ? TEST_TOPIC : "bad-topic", testPartitionId, settings).GetValueSync();
385+
while (true) {
386+
TDescribePartitionResult result = client.DescribePartition(existingTopic ? TEST_TOPIC : "bad-topic", testPartitionId, settings).GetValueSync();
387+
UNIT_ASSERT_C(result.GetStatus() == EStatus::SUCCESS || result.GetStatus() == EStatus::SCHEME_ERROR || result.GetStatus() == EStatus::UNAUTHORIZED, result.GetIssues());
388+
// Connect access may appear later
389+
if (result.GetStatus() != EStatus::UNAUTHORIZED)
390+
return result;
391+
Sleep(TDuration::Seconds(1));
392+
}
384393
}
385394

386395
Y_UNIT_TEST(DescribePartitionPermissions) {

src/client/topic/ut/local_partition_ut.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,8 @@ namespace NYdb::NTopic::NTests {
621621
auto setup = CreateSetup(TEST_CASE_NAME);
622622
auto authToken = "x-user-x@builtin";
623623

624+
setup->GetServer().AnnoyingClient->GrantConnect(authToken);
625+
624626
{
625627
// Allow UpdateRow only, no DescribeSchema permission.
626628
NACLib::TDiffACL acl;

0 commit comments

Comments
 (0)