summaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/test/ut
diff options
context:
space:
mode:
authorilnurkh <[email protected]>2023-10-09 23:39:40 +0300
committerilnurkh <[email protected]>2023-10-09 23:57:14 +0300
commite601ca03f859335d57ecff2e5aa6af234b6052ed (patch)
treede519a847e58a1b3993fcbfe05ff44cc946a3e24 /library/cpp/messagebus/test/ut
parentbbf2b6878af3854815a2c0ecb07a687071787639 (diff)
Y_VERIFY->Y_ABORT_UNLESS at ^l
https://clubs.at.yandex-team.ru/arcadia/29404
Diffstat (limited to 'library/cpp/messagebus/test/ut')
-rw-r--r--library/cpp/messagebus/test/ut/messagebus_ut.cpp30
-rw-r--r--library/cpp/messagebus/test/ut/module_client_ut.cpp14
-rw-r--r--library/cpp/messagebus/test/ut/module_server_ut.cpp4
-rw-r--r--library/cpp/messagebus/test/ut/one_way_ut.cpp2
4 files changed, 25 insertions, 25 deletions
diff --git a/library/cpp/messagebus/test/ut/messagebus_ut.cpp b/library/cpp/messagebus/test/ut/messagebus_ut.cpp
index 8d2f4aa444f..8f6aa6a2956 100644
--- a/library/cpp/messagebus/test/ut/messagebus_ut.cpp
+++ b/library/cpp/messagebus/test/ut/messagebus_ut.cpp
@@ -31,7 +31,7 @@ namespace {
}
void OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> reply) override {
- Y_VERIFY(AtomicGet(SentCompleted), "must be completed");
+ Y_ABORT_UNLESS(AtomicGet(SentCompleted), "must be completed");
TExampleClient::OnReply(mess, reply);
@@ -138,7 +138,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
void OnError(TAutoPtr<TBusMessage> message, EMessageStatus status) override {
Y_UNUSED(message);
- Y_VERIFY(status == MESSAGE_CONNECT_FAILED, "must be MESSAGE_CONNECT_FAILED, got %s", ToString(status).data());
+ Y_ABORT_UNLESS(status == MESSAGE_CONNECT_FAILED, "must be MESSAGE_CONNECT_FAILED, got %s", ToString(status).data());
TestSync.CheckAndIncrement((failures++) * 2);
}
@@ -159,7 +159,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
status = client.Session->SendMessageAutoPtr(message, &noServerAddr);
}
- Y_VERIFY(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data());
+ Y_ABORT_UNLESS(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data());
if (count == 0) {
// lame way to wait until it is connected
@@ -266,7 +266,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
TSystemEvent ErrorHappened;
void OnError(TAutoPtr<TBusMessage>, EMessageStatus status) override {
- Y_VERIFY(status == MESSAGE_CONNECT_FAILED || status == MESSAGE_TIMEOUT, "got status: %s", ToString(status).data());
+ Y_ABORT_UNLESS(status == MESSAGE_CONNECT_FAILED || status == MESSAGE_TIMEOUT, "got status: %s", ToString(status).data());
ErrorHappened.Signal();
}
};
@@ -327,7 +327,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
}
void OnMessage(TOnMessageContext& mess) override {
- Y_VERIFY(mess.IsConnectionAlive(), "connection should be alive here");
+ Y_ABORT_UNLESS(mess.IsConnectionAlive(), "connection should be alive here");
TAutoPtr<TOnMessageContext> delayedMsg(new TOnMessageContext);
delayedMsg->Swap(mess);
auto g(Guard(Lock_));
@@ -378,7 +378,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override {
Y_UNUSED(mess);
- Y_VERIFY(status == MESSAGE_SHUTDOWN, "only shutdown allowed, got %s", ToString(status).data());
+ Y_ABORT_UNLESS(status == MESSAGE_SHUTDOWN, "only shutdown allowed, got %s", ToString(status).data());
}
};
@@ -432,7 +432,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override {
Y_UNUSED(mess);
- Y_VERIFY(status == MESSAGE_SHUTDOWN, "only shutdown allowed");
+ Y_ABORT_UNLESS(status == MESSAGE_SHUTDOWN, "only shutdown allowed");
}
};
@@ -505,7 +505,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
void OnError(TAutoPtr<TBusMessage>, EMessageStatus status) override {
TestSync.WaitForAndIncrement(1);
- Y_VERIFY(status == MESSAGE_MESSAGE_TOO_LARGE, "status");
+ Y_ABORT_UNLESS(status == MESSAGE_MESSAGE_TOO_LARGE, "status");
}
};
@@ -697,7 +697,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override {
TestSync.WaitForAndIncrement(0);
- Y_VERIFY(status == MESSAGE_CONNECT_FAILED || status == MESSAGE_TIMEOUT, "must be connection failed, got %s", ToString(status).data());
+ Y_ABORT_UNLESS(status == MESSAGE_CONNECT_FAILED || status == MESSAGE_TIMEOUT, "must be connection failed, got %s", ToString(status).data());
mess.Destroy();
TestSync.CheckAndIncrement(1);
}
@@ -726,7 +726,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
void OnError(TAutoPtr<TBusMessage> message, EMessageStatus status) override {
TestSync.CheckAndIncrement(0);
- Y_VERIFY(status == MESSAGE_CONNECT_FAILED, "must be MESSAGE_CONNECT_FAILED, got %s", ToString(status).data());
+ Y_ABORT_UNLESS(status == MESSAGE_CONNECT_FAILED, "must be MESSAGE_CONNECT_FAILED, got %s", ToString(status).data());
// check reset is possible here
message->Reset();
@@ -755,7 +755,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
client.Session->Shutdown();
ok = client.Session->SendMessageOneWay(message);
- Y_VERIFY(ok == MESSAGE_SHUTDOWN, "must be shutdown when sending during shutdown, got %s", ToString(ok).data());
+ Y_ABORT_UNLESS(ok == MESSAGE_SHUTDOWN, "must be shutdown when sending during shutdown, got %s", ToString(ok).data());
// check reset is possible here
message->Reset();
@@ -1074,7 +1074,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
EMessageStatus status = client.Session->SendMessageOneWay(new TExampleRequest(&client.Proto.RequestCount),
&noServerAddr);
- Y_VERIFY(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data());
+ Y_ABORT_UNLESS(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data());
client.TestSync.WaitForAndIncrement(count * 2 + 1);
// First connection attempt is for connect call; second one is to get connect result.
@@ -1085,7 +1085,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
EMessageStatus status = client.Session->SendMessageOneWay(new TExampleRequest(&client.Proto.RequestCount),
&noServerAddr);
- Y_VERIFY(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data());
+ Y_ABORT_UNLESS(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data());
client.TestSync.WaitForAndIncrement(count * 2 + 1);
// First connection attempt is for connect call; second one is to get connect result.
@@ -1107,7 +1107,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
EMessageStatus status = client.Session->SendMessageOneWay(new TExampleRequest(&client.Proto.RequestCount),
&noServerAddr);
- Y_VERIFY(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data());
+ Y_ABORT_UNLESS(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data());
client.TestSync.WaitForAndIncrement(count * 2 + 1);
// First connection attempt is for connect call; second one is to get connect result.
@@ -1134,7 +1134,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
EMessageStatus status = client.Session->SendMessageOneWay(new TExampleRequest(&client.Proto.RequestCount),
&noServerAddr);
- Y_VERIFY(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data());
+ Y_ABORT_UNLESS(status == MESSAGE_OK, "must be MESSAGE_OK, got %s", ToString(status).data());
client.TestSync.WaitForAndIncrement(count * 2 + 1);
// First connection attempt is for connect call; second one is to get connect result.
diff --git a/library/cpp/messagebus/test/ut/module_client_ut.cpp b/library/cpp/messagebus/test/ut/module_client_ut.cpp
index ebfe185cc6d..a172b06bd2c 100644
--- a/library/cpp/messagebus/test/ut/module_client_ut.cpp
+++ b/library/cpp/messagebus/test/ut/module_client_ut.cpp
@@ -120,13 +120,13 @@ Y_UNIT_TEST_SUITE(BusJobTest) {
void ReplyHandler(TBusJob*, EMessageStatus status, TBusMessage* mess, TBusMessage* reply) {
Y_UNUSED(mess);
Y_UNUSED(reply);
- Y_VERIFY(status == MESSAGE_OK, "failed to get reply: %s", ToCString(status));
+ Y_ABORT_UNLESS(status == MESSAGE_OK, "failed to get reply: %s", ToCString(status));
}
TJobHandler HandleReplies(TBusJob* job, TBusMessage* mess) {
Y_UNUSED(mess);
RepliesLatch.CountDown();
- Y_VERIFY(RepliesLatch.Await(TDuration::Seconds(10)), "failed to get answers");
+ Y_ABORT_UNLESS(RepliesLatch.Await(TDuration::Seconds(10)), "failed to get answers");
job->Cancel(MESSAGE_UNKNOWN);
return nullptr;
}
@@ -178,9 +178,9 @@ Y_UNIT_TEST_SUITE(BusJobTest) {
}
void ReplyHandler(TBusJob*, EMessageStatus status, TBusMessage* req, TBusMessage* resp) {
- Y_VERIFY(status == MESSAGE_CONNECT_FAILED || status == MESSAGE_TIMEOUT, "got wrong status: %s", ToString(status).data());
- Y_VERIFY(req == SentMessage, "checking request");
- Y_VERIFY(resp == nullptr, "checking response");
+ Y_ABORT_UNLESS(status == MESSAGE_CONNECT_FAILED || status == MESSAGE_TIMEOUT, "got wrong status: %s", ToString(status).data());
+ Y_ABORT_UNLESS(req == SentMessage, "checking request");
+ Y_ABORT_UNLESS(resp == nullptr, "checking response");
GotReplyLatch.CountDown();
}
@@ -279,7 +279,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) {
void ReplyHandler(TBusJob* job, EMessageStatus status, TBusMessage* mess, TBusMessage* reply) {
Y_UNUSED(mess);
Y_UNUSED(reply);
- Y_VERIFY(status == MESSAGE_OK, "failed to get reply");
+ Y_ABORT_UNLESS(status == MESSAGE_OK, "failed to get reply");
if (AtomicIncrement(ReplyCount) == 1) {
TestSync->WaitForAndIncrement(1);
job->SendReply(new TExampleResponse(&Proto.ResponseCount));
@@ -338,7 +338,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) {
}
void HandleReply(TBusJob*, EMessageStatus status, TBusMessage*, TBusMessage*) {
- Y_VERIFY(status == MESSAGE_SHUTDOWN, "got %s", ToCString(status));
+ Y_ABORT_UNLESS(status == MESSAGE_SHUTDOWN, "got %s", ToCString(status));
TestSync.CheckAndIncrement(1);
}
diff --git a/library/cpp/messagebus/test/ut/module_server_ut.cpp b/library/cpp/messagebus/test/ut/module_server_ut.cpp
index 88fe1dd9b6d..b0e6ac38da4 100644
--- a/library/cpp/messagebus/test/ut/module_server_ut.cpp
+++ b/library/cpp/messagebus/test/ut/module_server_ut.cpp
@@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(ModuleServerTests) {
TJobHandler Start(TBusJob* job, TBusMessage* mess) override {
WaitTwoRequestsLatch.CountDown();
- Y_VERIFY(WaitTwoRequestsLatch.Await(TDuration::Seconds(5)), "oops");
+ Y_ABORT_UNLESS(WaitTwoRequestsLatch.Await(TDuration::Seconds(5)), "oops");
VerifyDynamicCast<TExampleRequest*>(mess);
@@ -83,7 +83,7 @@ Y_UNIT_TEST_SUITE(ModuleServerTests) {
MessageReceivedEvent.Signal();
- Y_VERIFY(ClientDiedEvent.WaitT(TDuration::Seconds(5)), "oops");
+ Y_ABORT_UNLESS(ClientDiedEvent.WaitT(TDuration::Seconds(5)), "oops");
job->SendReply(new TExampleResponse(&Proto.ResponseCount));
return nullptr;
diff --git a/library/cpp/messagebus/test/ut/one_way_ut.cpp b/library/cpp/messagebus/test/ut/one_way_ut.cpp
index 9c21227e2bd..0b90985289f 100644
--- a/library/cpp/messagebus/test/ut/one_way_ut.cpp
+++ b/library/cpp/messagebus/test/ut/one_way_ut.cpp
@@ -168,7 +168,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) {
void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override {
Y_UNUSED(mess);
- Y_VERIFY(status == MESSAGE_MESSAGE_TOO_LARGE, "wrong status: %s", ToCString(status));
+ Y_ABORT_UNLESS(status == MESSAGE_MESSAGE_TOO_LARGE, "wrong status: %s", ToCString(status));
GotTooLarge.Signal();
}