Skip to content

Commit

Permalink
24 1 14 fixes (#3947)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergey Veselov <[email protected]>
  • Loading branch information
alexnick88 and siarheivesialou authored Apr 19, 2024
1 parent 6933b5a commit 9c79c16
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ydb/core/ymq/actor/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@ class TActionActor
}
}

Y_ABORT_UNLESS(SchemeCache_);

bool isACLProtectedAccount = Cfg().GetForceAccessControl();
if (!IsCloud() && (SecurityToken_ || (Cfg().GetForceAccessControl() && (isACLProtectedAccount = IsACLProtectedAccount(UserName_))))) {
this->Become(&TActionActor::WaitAuthCheckMessages);
Expand All @@ -666,8 +668,6 @@ class TActionActor
return;
}

Y_ABORT_UNLESS(SchemeCache_);

RequestSchemeCache(GetActionACLSourcePath()); // this also checks that requested queue (if any) does exist
RequestTicketParser();
} else {
Expand Down
1 change: 1 addition & 0 deletions ydb/core/ymq/actor/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ void TSqsService::AnswerThrottled(TSqsEvents::TEvGetConfiguration::TPtr& ev) {
RLOG_SQS_REQ_DEBUG(ev->Get()->RequestId, "Throttled because of too many requests for nonexistent queue [" << ev->Get()->QueueName << "] for user [" << ev->Get()->UserName << "] while getting configuration");
auto answer = MakeHolder<TSqsEvents::TEvConfiguration>();
answer->Throttled = true;
answer->SchemeCache = SchemeCache_;
Send(ev->Sender, answer.Release());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from ydb.tests.library.sqs.test_base import KikimrSqsTestBase

throttling_exception_pattern = ".*</Message><Code>ThrottlingException</Code>.*"


class TestSqsThrottlingOnNonexistentQueue(KikimrSqsTestBase):

Expand All @@ -21,8 +23,6 @@ def get_attributes_of_nonexistent_queue():
except Exception:
pass

throttling_exception_pattern = ".*</Message><Code>ThrottlingException</Code>.*"

assert_that(
get_attributes_of_nonexistent_queue,
raises(
Expand All @@ -46,3 +46,25 @@ def get_attributes_of_nonexistent_queue():
pattern=throttling_exception_pattern
)
)

def test_action_which_does_not_requere_existing_queue(self):
queue_url = self._create_queue_and_assert(self.queue_name, False, True)
nonexistent_queue_url = queue_url + "_nonex"

def get_attributes_of_nonexistent_queue():
self._sqs_api.get_queue_attributes(nonexistent_queue_url)

# Draining budget
for _ in range(16):
try:
get_attributes_of_nonexistent_queue()
except Exception:
pass

assert_that(
lambda: self._sqs_api.get_queue_url(self.queue_name + "_nonex"),
raises(
RuntimeError,
pattern=throttling_exception_pattern
)
)

0 comments on commit 9c79c16

Please sign in to comment.