diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/messagebus/test | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/test')
14 files changed, 142 insertions, 142 deletions
diff --git a/library/cpp/messagebus/test/example/client/client.cpp b/library/cpp/messagebus/test/example/client/client.cpp index 89b5f2c9be..5e18fd8990 100644 --- a/library/cpp/messagebus/test/example/client/client.cpp +++ b/library/cpp/messagebus/test/example/client/client.cpp @@ -23,7 +23,7 @@ namespace NCalculator { } void OnReply(TAutoPtr<TBusMessage> request, TAutoPtr<TBusMessage> response0) override { - Y_VERIFY(response0->GetHeader()->Type == TResponse::MessageType, "wrong response"); + Y_VERIFY(response0->GetHeader()->Type == TResponse::MessageType, "wrong response"); TResponse* response = VerifyDynamicCast<TResponse*>(response0.Get()); if (request->GetHeader()->Type == TRequestSum::MessageType) { TRequestSum* requestSum = VerifyDynamicCast<TRequestSum*>(request.Get()); @@ -36,7 +36,7 @@ namespace NCalculator { int b = requestMul->Record.GetB(); Cerr << a << " * " << b << " = " << response->Record.GetResult() << "\n"; } else { - Y_FAIL("unknown request"); + Y_FAIL("unknown request"); } } diff --git a/library/cpp/messagebus/test/example/server/server.cpp b/library/cpp/messagebus/test/example/server/server.cpp index 13e52d75f5..27d427491b 100644 --- a/library/cpp/messagebus/test/example/server/server.cpp +++ b/library/cpp/messagebus/test/example/server/server.cpp @@ -39,7 +39,7 @@ namespace NCalculator { response->Record.SetResult(result); request.SendReplyMove(response); } else { - Y_FAIL("unknown request"); + Y_FAIL("unknown request"); } } }; diff --git a/library/cpp/messagebus/test/helper/alloc_counter.h b/library/cpp/messagebus/test/helper/alloc_counter.h index ec9041cb15..0f7631166b 100644 --- a/library/cpp/messagebus/test/helper/alloc_counter.h +++ b/library/cpp/messagebus/test/helper/alloc_counter.h @@ -16,6 +16,6 @@ public: } ~TAllocCounter() { - Y_VERIFY(AtomicDecrement(*CountPtr) >= 0, "released too many"); + Y_VERIFY(AtomicDecrement(*CountPtr) >= 0, "released too many"); } }; diff --git a/library/cpp/messagebus/test/helper/example.cpp b/library/cpp/messagebus/test/helper/example.cpp index 7c6d704042..07b8e47c74 100644 --- a/library/cpp/messagebus/test/helper/example.cpp +++ b/library/cpp/messagebus/test/helper/example.cpp @@ -68,11 +68,11 @@ TExampleProtocol::~TExampleProtocol() { // so it could be reported in test return; } - Y_VERIFY(0 == AtomicGet(RequestCount), "protocol %s: must be 0 requests allocated, actually %d", GetService(), int(RequestCount)); - Y_VERIFY(0 == AtomicGet(ResponseCount), "protocol %s: must be 0 responses allocated, actually %d", GetService(), int(ResponseCount)); - Y_VERIFY(0 == AtomicGet(RequestCountDeserialized), "protocol %s: must be 0 requests deserialized allocated, actually %d", GetService(), int(RequestCountDeserialized)); - Y_VERIFY(0 == AtomicGet(ResponseCountDeserialized), "protocol %s: must be 0 responses deserialized allocated, actually %d", GetService(), int(ResponseCountDeserialized)); - Y_VERIFY(0 == AtomicGet(StartCount), "protocol %s: must be 0 start objects allocated, actually %d", GetService(), int(StartCount)); + Y_VERIFY(0 == AtomicGet(RequestCount), "protocol %s: must be 0 requests allocated, actually %d", GetService(), int(RequestCount)); + Y_VERIFY(0 == AtomicGet(ResponseCount), "protocol %s: must be 0 responses allocated, actually %d", GetService(), int(ResponseCount)); + Y_VERIFY(0 == AtomicGet(RequestCountDeserialized), "protocol %s: must be 0 requests deserialized allocated, actually %d", GetService(), int(RequestCountDeserialized)); + Y_VERIFY(0 == AtomicGet(ResponseCountDeserialized), "protocol %s: must be 0 responses deserialized allocated, actually %d", GetService(), int(ResponseCountDeserialized)); + Y_VERIFY(0 == AtomicGet(StartCount), "protocol %s: must be 0 start objects allocated, actually %d", GetService(), int(StartCount)); } void TExampleProtocol::Serialize(const TBusMessage* message, TBuffer& buffer) { @@ -83,13 +83,13 @@ void TExampleProtocol::Serialize(const TBusMessage* message, TBuffer& buffer) { } else if (const TExampleResponse* exampleReply = dynamic_cast<const TExampleResponse*>(message)) { buffer.Append(exampleReply->Data.data(), exampleReply->Data.size()); } else { - Y_FAIL("unknown message type"); + Y_FAIL("unknown message type"); } } TAutoPtr<TBusMessage> TExampleProtocol::Deserialize(ui16 messageType, TArrayRef<const char> payload) { // TODO: check data - Y_UNUSED(payload); + Y_UNUSED(payload); if (messageType == 77) { TExampleRequest* exampleMessage = new TExampleRequest(MESSAGE_CREATE_UNINITIALIZED, &RequestCountDeserialized); @@ -194,8 +194,8 @@ void TExampleClient::SendMessagesWaitReplies(size_t count, const TNetAddr& addr) } void TExampleClient::OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> reply) { - Y_UNUSED(mess); - Y_UNUSED(reply); + Y_UNUSED(mess); + Y_UNUSED(reply); if (AtomicIncrement(RepliesCount) == MessageCount) { WorkDone.Signal(); @@ -204,10 +204,10 @@ void TExampleClient::OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> r void TExampleClient::OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) { if (CrashOnError) { - Y_FAIL("client failed: %s", ToCString(status)); + Y_FAIL("client failed: %s", ToCString(status)); } - Y_UNUSED(mess); + Y_UNUSED(mess); AtomicIncrement(Errors); LastError = status; diff --git a/library/cpp/messagebus/test/helper/message_handler_error.cpp b/library/cpp/messagebus/test/helper/message_handler_error.cpp index c09811ec67..421e0ce397 100644 --- a/library/cpp/messagebus/test/helper/message_handler_error.cpp +++ b/library/cpp/messagebus/test/helper/message_handler_error.cpp @@ -10,11 +10,11 @@ void TBusClientHandlerError::OnError(TAutoPtr<TBusMessage>, EMessageStatus statu } void TBusClientHandlerError::OnReply(TAutoPtr<TBusMessage>, TAutoPtr<TBusMessage>) { - Y_FAIL("must not be called"); + Y_FAIL("must not be called"); } void TBusClientHandlerError::OnMessageSentOneWay(TAutoPtr<TBusMessage>) { - Y_FAIL("must not be called"); + Y_FAIL("must not be called"); } void TBusServerHandlerError::OnError(TAutoPtr<TBusMessage>, EMessageStatus status) { @@ -22,5 +22,5 @@ void TBusServerHandlerError::OnError(TAutoPtr<TBusMessage>, EMessageStatus statu } void TBusServerHandlerError::OnMessage(TOnMessageContext&) { - Y_FAIL("must not be called"); + Y_FAIL("must not be called"); } diff --git a/library/cpp/messagebus/test/perftest/perftest.cpp b/library/cpp/messagebus/test/perftest/perftest.cpp index 8489319278..de1ee427a2 100644 --- a/library/cpp/messagebus/test/perftest/perftest.cpp +++ b/library/cpp/messagebus/test/perftest/perftest.cpp @@ -150,7 +150,7 @@ TAutoPtr<TBusMessage> NewRequest() { void CheckRequest(TPerftestRequest* request) { const TString& data = request->Record.GetData(); for (size_t i = 0; i != data.size(); ++i) { - Y_VERIFY(data.at(i) == '?', "must be question mark"); + Y_VERIFY(data.at(i) == '?', "must be question mark"); } } @@ -164,7 +164,7 @@ TAutoPtr<TPerftestResponse> NewResponse(TPerftestRequest* request) { void CheckResponse(TPerftestResponse* response) { const TString& data = response->Record.GetData(); for (size_t i = 0; i != data.size(); ++i) { - Y_VERIFY(data.at(i) == '.', "must be dot"); + Y_VERIFY(data.at(i) == '.', "must be dot"); } } @@ -279,7 +279,7 @@ public: //delete message; //Sleep(TDuration::MilliSeconds(1)); //continue; - Y_FAIL("unreachable"); + Y_FAIL("unreachable"); } else if (ret == MESSAGE_SHUTDOWN) { delete message; } else { @@ -295,7 +295,7 @@ public: /// actual work is being done here void OnReply(TAutoPtr<TBusMessage> mess, TAutoPtr<TBusMessage> reply) override { - Y_UNUSED(mess); + Y_UNUSED(mess); if (Config.SimpleProtocol) { VerifyDynamicCast<TSimpleMessage*>(reply.Get()); @@ -310,8 +310,8 @@ public: /// message that could not be delivered void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override { - Y_UNUSED(mess); - Y_UNUSED(status); + Y_UNUSED(mess); + Y_UNUSED(status); if (TheExit) { return; @@ -319,7 +319,7 @@ public: Stats.IncErrors(); - // Y_ASSERT(TheConfig->Failure > 0.0); + // Y_ASSERT(TheConfig->Failure > 0.0); } }; @@ -368,7 +368,7 @@ public: { /// register destination session Session = TBusServerSession::Create(Proto.Get(), this, Config.ServerSessionConfig, Bus); - Y_ASSERT(Session && "probably somebody is listening on the same port"); + Y_ASSERT(Session && "probably somebody is listening on the same port"); } /// when message comes, send reply @@ -416,8 +416,8 @@ public: : TPerftestServerCommon("server") , TBusModule("fast") { - Y_VERIFY(CreatePrivateSessions(Bus.Get()), "failed to initialize dupdetect module"); - Y_VERIFY(StartInput(), "failed to start input"); + Y_VERIFY(CreatePrivateSessions(Bus.Get()), "failed to initialize dupdetect module"); + Y_VERIFY(StartInput(), "failed to start input"); } ~TPerftestUsingModule() override { @@ -479,7 +479,7 @@ TVector<TNetAddr> ParseNodes(const TString nodes) { for (int i = 0; i < int(numh); i++) { const TNetworkAddress& networkAddress = ParseNetworkAddress(hosts[i].data()); - Y_VERIFY(networkAddress.Begin() != networkAddress.End(), "no addresses"); + Y_VERIFY(networkAddress.Begin() != networkAddress.End(), "no addresses"); r.push_back(TNetAddr(networkAddress, &*networkAddress.Begin())); } @@ -549,9 +549,9 @@ void TTestStats::PeriodicallyPrint() { (unsigned)ServerUsingModule->Bus->GetExecutor()->GetWorkQueueSize(), ServerUsingModule->Session->GetStatusSingleLine().data()); } - for (const auto& client : clients) { + for (const auto& client : clients) { fprintf(stderr, "client: q: %u %s\n", - (unsigned)client->Bus->GetExecutor()->GetWorkQueueSize(), + (unsigned)client->Bus->GetExecutor()->GetWorkQueueSize(), client->Session->GetStatusSingleLine().data()); } @@ -574,13 +574,13 @@ void TTestStats::PeriodicallyPrint() { stats << "server using modules:\n"; stats << IndentText(ServerUsingModule->Bus->GetStatus()); } - for (const auto& client : clients) { + for (const auto& client : clients) { if (!first) { stats << "\n"; } first = false; stats << "client:\n"; - stats << IndentText(client->Bus->GetStatus()); + stats << IndentText(client->Bus->GetStatus()); } TUnbufferedFileOutput("stats").Write(stats.Str()); @@ -693,15 +693,15 @@ int main(int argc, char* argv[]) { if (!clients.empty()) { Cerr << "Stopping clients\n"; - for (auto& client : clients) { - client->Stop(); + for (auto& client : clients) { + client->Stop(); } } wwwServer.Destroy(); - for (const auto& future : futures) { - future->Get(); + for (const auto& future : futures) { + future->Get(); } if (TheConfig->Profile) { diff --git a/library/cpp/messagebus/test/perftest/simple_proto.cpp b/library/cpp/messagebus/test/perftest/simple_proto.cpp index 19d6c15b9d..e478bda000 100644 --- a/library/cpp/messagebus/test/perftest/simple_proto.cpp +++ b/library/cpp/messagebus/test/perftest/simple_proto.cpp @@ -7,7 +7,7 @@ using namespace NBus; void TSimpleProtocol::Serialize(const TBusMessage* mess, TBuffer& data) { - Y_VERIFY(typeid(TSimpleMessage) == typeid(*mess)); + Y_VERIFY(typeid(TSimpleMessage) == typeid(*mess)); const TSimpleMessage* typed = static_cast<const TSimpleMessage*>(mess); data.Append((const char*)&typed->Payload, 4); } diff --git a/library/cpp/messagebus/test/ut/messagebus_ut.cpp b/library/cpp/messagebus/test/ut/messagebus_ut.cpp index 040f9b7702..b333e2fe23 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_VERIFY(AtomicGet(SentCompleted), "must be completed"); TExampleClient::OnReply(mess, reply); @@ -46,7 +46,7 @@ namespace { } -Y_UNIT_TEST_SUITE(TMessageBusTests) { +Y_UNIT_TEST_SUITE(TMessageBusTests) { void TestDestinationTemplate(bool useCompression, bool ackMessageBeforeReply, const TBusServerSessionConfig& sessionConfig) { TObjectCountCheck objectCountCheck; @@ -66,19 +66,19 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { UNIT_ASSERT_EQUAL(client.Session->GetInFlight(), 0); } - Y_UNIT_TEST(TestDestination) { + Y_UNIT_TEST(TestDestination) { TestDestinationTemplate(false, false, TBusServerSessionConfig()); } - Y_UNIT_TEST(TestDestinationUsingAck) { + Y_UNIT_TEST(TestDestinationUsingAck) { TestDestinationTemplate(false, true, TBusServerSessionConfig()); } - Y_UNIT_TEST(TestDestinationWithCompression) { + Y_UNIT_TEST(TestDestinationWithCompression) { TestDestinationTemplate(true, false, TBusServerSessionConfig()); } - Y_UNIT_TEST(TestCork) { + Y_UNIT_TEST(TestCork) { TBusServerSessionConfig config; config.SendThreshold = 1000000000000; config.Cork = TDuration::MilliSeconds(10); @@ -86,7 +86,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { // TODO: test for cork hanging } - Y_UNIT_TEST(TestReconnect) { + Y_UNIT_TEST(TestReconnect) { if (!IsFixedPortTestAllowed()) { return; } @@ -136,7 +136,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } void OnError(TAutoPtr<TBusMessage> message, EMessageStatus status) override { - Y_UNUSED(message); + Y_UNUSED(message); Y_VERIFY(status == MESSAGE_CONNECT_FAILED, "must be MESSAGE_CONNECT_FAILED, got %s", ToString(status).data()); @@ -194,7 +194,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { UNIT_ASSERT_VALUES_EQUAL(client.Session->GetConfig()->MaxInFlight, count); } - Y_UNIT_TEST(TestHangindServer) { + Y_UNIT_TEST(TestHangindServer) { TObjectCountCheck objectCountCheck; THangingServer server(0); @@ -202,13 +202,13 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { HangingServerImpl(server.GetPort()); } - Y_UNIT_TEST(TestNoServer) { + Y_UNIT_TEST(TestNoServer) { TObjectCountCheck objectCountCheck; TestNoServerImpl(17, false); } - Y_UNIT_TEST(PauseInput) { + Y_UNIT_TEST(PauseInput) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -283,15 +283,15 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.ErrorHappened.WaitI(); } - Y_UNIT_TEST(NoServer_SendTimeout_Callback_PeriodLess) { + Y_UNIT_TEST(NoServer_SendTimeout_Callback_PeriodLess) { NoServer_SendTimeout_Callback_Impl(true); } - Y_UNIT_TEST(NoServer_SendTimeout_Callback_TimeoutLess) { + Y_UNIT_TEST(NoServer_SendTimeout_Callback_TimeoutLess) { NoServer_SendTimeout_Callback_Impl(false); } - Y_UNIT_TEST(TestOnReplyCalledAfterOnMessageSent) { + Y_UNIT_TEST(TestOnReplyCalledAfterOnMessageSent) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -327,7 +327,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } void OnMessage(TOnMessageContext& mess) override { - Y_VERIFY(mess.IsConnectionAlive(), "connection should be alive here"); + Y_VERIFY(mess.IsConnectionAlive(), "connection should be alive here"); TAutoPtr<TOnMessageContext> delayedMsg(new TOnMessageContext); delayedMsg->Swap(mess); auto g(Guard(Lock_)); @@ -337,8 +337,8 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { bool CheckClientIsAlive() { auto g(Guard(Lock_)); - for (auto& delayedMessage : DelayedMessages) { - if (!delayedMessage->IsConnectionAlive()) { + for (auto& delayedMessage : DelayedMessages) { + if (!delayedMessage->IsConnectionAlive()) { return false; } } @@ -347,8 +347,8 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { bool CheckClientIsDead() const { auto g(Guard(Lock_)); - for (const auto& delayedMessage : DelayedMessages) { - if (delayedMessage->IsConnectionAlive()) { + for (const auto& delayedMessage : DelayedMessages) { + if (delayedMessage->IsConnectionAlive()) { return false; } } @@ -377,12 +377,12 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override { - Y_UNUSED(mess); + Y_UNUSED(mess); Y_VERIFY(status == MESSAGE_SHUTDOWN, "only shutdown allowed, got %s", ToString(status).data()); } }; - Y_UNIT_TEST(TestReplyCalledAfterClientDisconnected) { + Y_UNIT_TEST(TestReplyCalledAfterClientDisconnected) { TObjectCountCheck objectCountCheck; TDelayReplyServer server; @@ -431,12 +431,12 @@ 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_UNUSED(mess); + Y_VERIFY(status == MESSAGE_SHUTDOWN, "only shutdown allowed"); } }; - Y_UNIT_TEST(PackUnpack) { + Y_UNIT_TEST(PackUnpack) { TObjectCountCheck objectCountCheck; TPackUnpackServer server; @@ -446,7 +446,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client->SendMessagesWaitReplies(1, TNetAddr("localhost", server.Session->GetActualListenPort())); } - Y_UNIT_TEST(ClientRequestTooLarge) { + Y_UNIT_TEST(ClientRequestTooLarge) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -505,11 +505,11 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { void OnError(TAutoPtr<TBusMessage>, EMessageStatus status) override { TestSync.WaitForAndIncrement(1); - Y_VERIFY(status == MESSAGE_MESSAGE_TOO_LARGE, "status"); + Y_VERIFY(status == MESSAGE_MESSAGE_TOO_LARGE, "status"); } }; - Y_UNIT_TEST(ServerResponseTooLarge) { + Y_UNIT_TEST(ServerResponseTooLarge) { TObjectCountCheck objectCountCheck; TServerForResponseTooLarge server; @@ -555,12 +555,12 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { TAutoPtr<TExampleResponse> resp(new TExampleResponse(&Proto.ResponseCount, 10)); req.SendReplyMove(resp); } else { - Y_FAIL("wrong"); + Y_FAIL("wrong"); } } }; - Y_UNIT_TEST(ServerRequestTooLarge) { + Y_UNIT_TEST(ServerRequestTooLarge) { TObjectCountCheck objectCountCheck; TServerForRequestTooLarge server; @@ -578,7 +578,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.WaitForError(MESSAGE_DELIVERY_FAILED); } - Y_UNIT_TEST(ClientResponseTooLarge) { + Y_UNIT_TEST(ClientResponseTooLarge) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -598,7 +598,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.WaitForError(MESSAGE_DELIVERY_FAILED); } - Y_UNIT_TEST(ServerUnknownMessage) { + Y_UNIT_TEST(ServerUnknownMessage) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -616,7 +616,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.WaitForError(MESSAGE_DELIVERY_FAILED); } - Y_UNIT_TEST(ServerMessageReservedIds) { + Y_UNIT_TEST(ServerMessageReservedIds) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -641,7 +641,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.WaitForError(MESSAGE_DELIVERY_FAILED); } - Y_UNIT_TEST(TestGetInFlightForDestination) { + Y_UNIT_TEST(TestGetInFlightForDestination) { TObjectCountCheck objectCountCheck; TDelayReplyServer server; @@ -703,7 +703,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(ResetAfterSendOneWayErrorInCallback) { + Y_UNIT_TEST(ResetAfterSendOneWayErrorInCallback) { TObjectCountCheck objectCountCheck; TNetAddr noServerAddr("localhost", 17); @@ -739,7 +739,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(ResetAfterSendMessageOneWayDuringShutdown) { + Y_UNIT_TEST(ResetAfterSendMessageOneWayDuringShutdown) { TObjectCountCheck objectCountCheck; TNetAddr noServerAddr("localhost", 17); @@ -764,7 +764,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { delete message; } - Y_UNIT_TEST(ResetAfterSendOneWayErrorInReturn) { + Y_UNIT_TEST(ResetAfterSendOneWayErrorInReturn) { TObjectCountCheck objectCountCheck; TestNoServerImpl(17, true); @@ -784,7 +784,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(ResetAfterSendOneWaySuccess) { + Y_UNIT_TEST(ResetAfterSendOneWaySuccess) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -800,7 +800,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.TestSync.WaitForAndIncrement(2); } - Y_UNIT_TEST(GetStatus) { + Y_UNIT_TEST(GetStatus) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -818,7 +818,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.Bus->GetStatus(); } - Y_UNIT_TEST(BindOnRandomPort) { + Y_UNIT_TEST(BindOnRandomPort) { TObjectCountCheck objectCountCheck; TBusServerSessionConfig serverConfig; @@ -829,7 +829,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.SendMessagesWaitReplies(3, &addr); } - Y_UNIT_TEST(UnbindOnShutdown) { + Y_UNIT_TEST(UnbindOnShutdown) { TBusMessageQueuePtr queue(CreateMessageQueue()); TExampleProtocol proto; @@ -846,7 +846,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { THangingServer hangingServer(port); } - Y_UNIT_TEST(VersionNegotiation) { + Y_UNIT_TEST(VersionNegotiation) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -928,7 +928,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(OnClientConnectionEvent_Shutdown) { + Y_UNIT_TEST(OnClientConnectionEvent_Shutdown) { TObjectCountCheck objectCountCheck; TOnConnectionEventServer server; @@ -946,7 +946,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { client.Sync.WaitForAndIncrement(3); } - Y_UNIT_TEST(OnClientConnectionEvent_Disconnect) { + Y_UNIT_TEST(OnClientConnectionEvent_Disconnect) { TObjectCountCheck objectCountCheck; THolder<TOnConnectionEventServer> server(new TOnConnectionEventServer); @@ -1010,7 +1010,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(WakeReaderOnQuota) { + Y_UNIT_TEST(WakeReaderOnQuota) { const size_t test_msg_count = 64; TBusClientSessionConfig clientConfig; @@ -1061,7 +1061,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { server.WaitForOnMessageCount(test_msg_count); }; - Y_UNIT_TEST(TestConnectionAttempts) { + Y_UNIT_TEST(TestConnectionAttempts) { TObjectCountCheck objectCountCheck; TNetAddr noServerAddr("localhost", 17); @@ -1093,7 +1093,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { } }; - Y_UNIT_TEST(TestConnectionAttemptsOnNoMessagesAndNotReconnectWhenIdle) { + Y_UNIT_TEST(TestConnectionAttemptsOnNoMessagesAndNotReconnectWhenIdle) { TObjectCountCheck objectCountCheck; TNetAddr noServerAddr("localhost", 17); @@ -1120,7 +1120,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) { UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2); }; - Y_UNIT_TEST(TestConnectionAttemptsOnNoMessagesAndReconnectWhenIdle) { + Y_UNIT_TEST(TestConnectionAttemptsOnNoMessagesAndReconnectWhenIdle) { TObjectCountCheck objectCountCheck; TNetAddr noServerAddr("localhost", 17); diff --git a/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp b/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp index 4083cf3b7b..e7f2f5bd11 100644 --- a/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp +++ b/library/cpp/messagebus/test/ut/module_client_one_way_ut.cpp @@ -9,7 +9,7 @@ using namespace NBus; using namespace NBus::NTest; -Y_UNIT_TEST_SUITE(ModuleClientOneWay) { +Y_UNIT_TEST_SUITE(ModuleClientOneWay) { struct TTestServer: public TBusServerHandlerError { TExampleProtocol Proto; @@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(ModuleClientOneWay) { } }; - Y_UNIT_TEST(Simple) { + Y_UNIT_TEST(Simple) { TTestSync testSync; TTestServer server(&testSync); @@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(ModuleClientOneWay) { } }; - Y_UNIT_TEST(SendError) { + Y_UNIT_TEST(SendError) { TTestSync testSync; TBusQueueConfig queueConfig; diff --git a/library/cpp/messagebus/test/ut/module_client_ut.cpp b/library/cpp/messagebus/test/ut/module_client_ut.cpp index ebfe185cc6..16d2f22335 100644 --- a/library/cpp/messagebus/test/ut/module_client_ut.cpp +++ b/library/cpp/messagebus/test/ut/module_client_ut.cpp @@ -50,9 +50,9 @@ public: } }; -Y_UNIT_TEST_SUITE(BusJobTest) { +Y_UNIT_TEST_SUITE(BusJobTest) { #if 0 - Y_UNIT_TEST(TestPending) { + Y_UNIT_TEST(TestPending) { TObjectCountCheck objectCountCheck; TDupDetectModule module; @@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { UNIT_ASSERT_EQUAL(msg, pending[0].Message); } - Y_UNIT_TEST(TestCallReplyHandler) { + Y_UNIT_TEST(TestCallReplyHandler) { TObjectCountCheck objectCountCheck; TDupDetectModule module; @@ -112,27 +112,27 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); job->Send(new TExampleRequest(&Proto.RequestCount), Source, TReplyHandler(&TParallelOnReplyModule::ReplyHandler), 0, ServerAddr); return &TParallelOnReplyModule::HandleReplies; } 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_UNUSED(mess); + Y_UNUSED(reply); + Y_VERIFY(status == MESSAGE_OK, "failed to get reply: %s", ToCString(status)); } TJobHandler HandleReplies(TBusJob* job, TBusMessage* mess) { - Y_UNUSED(mess); + Y_UNUSED(mess); RepliesLatch.CountDown(); - Y_VERIFY(RepliesLatch.Await(TDuration::Seconds(10)), "failed to get answers"); + Y_VERIFY(RepliesLatch.Await(TDuration::Seconds(10)), "failed to get answers"); job->Cancel(MESSAGE_UNKNOWN); return nullptr; } }; - Y_UNIT_TEST(TestReplyHandlerCalledInParallel) { + Y_UNIT_TEST(TestReplyHandlerCalledInParallel) { TObjectCountCheck objectCountCheck; TExampleServer server; @@ -170,7 +170,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); TExampleRequest* message = new TExampleRequest(&Proto.RequestCount); job->Send(message, Source, TReplyHandler(&TErrorHandlerCheckerModule::ReplyHandler), 0, ServerAddr); SentMessage = message; @@ -179,13 +179,13 @@ 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_VERIFY(req == SentMessage, "checking request"); + Y_VERIFY(resp == nullptr, "checking response"); GotReplyLatch.CountDown(); } TJobHandler HandleReplies(TBusJob* job, TBusMessage* mess) { - Y_UNUSED(mess); + Y_UNUSED(mess); job->Cancel(MESSAGE_UNKNOWN); GotReplyLatch.CountDown(); return nullptr; @@ -201,7 +201,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } }; - Y_UNIT_TEST(ErrorHandler) { + Y_UNIT_TEST(ErrorHandler) { TExampleProtocol proto; TBusQueueConfig config; @@ -264,7 +264,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); for (unsigned i = 0; i < 2; ++i) { job->Send( new TExampleRequest(&Proto.RequestCount), @@ -277,9 +277,9 @@ 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_UNUSED(mess); + Y_UNUSED(reply); + Y_VERIFY(status == MESSAGE_OK, "failed to get reply"); if (AtomicIncrement(ReplyCount) == 1) { TestSync->WaitForAndIncrement(1); job->SendReply(new TExampleResponse(&Proto.ResponseCount)); @@ -289,7 +289,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } TJobHandler HandleReplies(TBusJob* job, TBusMessage* mess) { - Y_UNUSED(mess); + Y_UNUSED(mess); job->Cancel(MESSAGE_UNKNOWN); return nullptr; } @@ -301,7 +301,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } }; - Y_UNIT_TEST(SendReplyCalledBeforeAllRepliesReceived) { + Y_UNIT_TEST(SendReplyCalledBeforeAllRepliesReceived) { TTestSync testSync; TSlowReplyServer slowReplyServer(&testSync); @@ -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_VERIFY(status == MESSAGE_SHUTDOWN, "got %s", ToCString(status)); TestSync.CheckAndIncrement(1); } @@ -349,7 +349,7 @@ Y_UNIT_TEST_SUITE(BusJobTest) { } }; - Y_UNIT_TEST(ShutdownCalledBeforeReplyReceived) { + Y_UNIT_TEST(ShutdownCalledBeforeReplyReceived) { TExampleServer server; server.ForgetRequest = true; diff --git a/library/cpp/messagebus/test/ut/module_server_ut.cpp b/library/cpp/messagebus/test/ut/module_server_ut.cpp index 88fe1dd9b6..4acc9e3f59 100644 --- a/library/cpp/messagebus/test/ut/module_server_ut.cpp +++ b/library/cpp/messagebus/test/ut/module_server_ut.cpp @@ -15,8 +15,8 @@ using namespace NBus; using namespace NBus::NTest; -Y_UNIT_TEST_SUITE(ModuleServerTests) { - Y_UNIT_TEST(TestModule) { +Y_UNIT_TEST_SUITE(ModuleServerTests) { + Y_UNIT_TEST(TestModule) { TObjectCountCheck objectCountCheck; /// create or get instance of message queue, need one per application @@ -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_VERIFY(WaitTwoRequestsLatch.Await(TDuration::Seconds(5)), "oops"); VerifyDynamicCast<TExampleRequest*>(mess); @@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(ModuleServerTests) { } }; - Y_UNIT_TEST(TestOnMessageHandlerCalledInParallel) { + Y_UNIT_TEST(TestOnMessageHandlerCalledInParallel) { TObjectCountCheck objectCountCheck; TBusQueueConfig config; @@ -79,18 +79,18 @@ Y_UNIT_TEST_SUITE(ModuleServerTests) { TSystemEvent ClientDiedEvent; TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); MessageReceivedEvent.Signal(); - Y_VERIFY(ClientDiedEvent.WaitT(TDuration::Seconds(5)), "oops"); + Y_VERIFY(ClientDiedEvent.WaitT(TDuration::Seconds(5)), "oops"); job->SendReply(new TExampleResponse(&Proto.ResponseCount)); return nullptr; } }; - Y_UNIT_TEST(TestReplyCalledAfterClientDisconnected) { + Y_UNIT_TEST(TestReplyCalledAfterClientDisconnected) { TObjectCountCheck objectCountCheck; TBusQueueConfig config; diff --git a/library/cpp/messagebus/test/ut/one_way_ut.cpp b/library/cpp/messagebus/test/ut/one_way_ut.cpp index 9c21227e2b..7f18da400e 100644 --- a/library/cpp/messagebus/test/ut/one_way_ut.cpp +++ b/library/cpp/messagebus/test/ut/one_way_ut.cpp @@ -114,7 +114,7 @@ public: void OnMessage(TOnMessageContext& mess) override { TExampleRequest* fmess = static_cast<TExampleRequest*>(mess.GetMessage()); - Y_ASSERT(fmess->Data == "TADA"); + Y_ASSERT(fmess->Data == "TADA"); /// tell session to forget this message and never expect any reply mess.ForgetRequest(); @@ -124,13 +124,13 @@ public: /// this handler should not be called because this server does not send replies void OnSent(TAutoPtr<TBusMessage> mess) override { - Y_UNUSED(mess); - Y_FAIL("This server does not sent replies"); + Y_UNUSED(mess); + Y_FAIL("This server does not sent replies"); } }; -Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) { - Y_UNIT_TEST(Simple) { +Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) { + Y_UNIT_TEST(Simple) { TObjectCountCheck objectCountCheck; NullServer server; @@ -166,15 +166,15 @@ Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) { } void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override { - Y_UNUSED(mess); + Y_UNUSED(mess); - Y_VERIFY(status == MESSAGE_MESSAGE_TOO_LARGE, "wrong status: %s", ToCString(status)); + Y_VERIFY(status == MESSAGE_MESSAGE_TOO_LARGE, "wrong status: %s", ToCString(status)); GotTooLarge.Signal(); } }; - Y_UNIT_TEST(MessageTooLargeOnClient) { + Y_UNIT_TEST(MessageTooLargeOnClient) { TObjectCountCheck objectCountCheck; NullServer server; @@ -209,14 +209,14 @@ Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) { /// message that could not be delivered void OnError(TAutoPtr<TBusMessage> mess, EMessageStatus status) override { - Y_UNUSED(mess); - Y_UNUSED(status); // TODO: check status + Y_UNUSED(mess); + Y_UNUSED(status); // TODO: check status GotError.Signal(); } }; - Y_UNIT_TEST(SendTimeout_Callback_NoServer) { + Y_UNIT_TEST(SendTimeout_Callback_NoServer) { TObjectCountCheck objectCountCheck; TCheckTimeoutClient client(TNetAddr("localhost", 17)); @@ -227,7 +227,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) { client.GotError.WaitI(); } - Y_UNIT_TEST(SendTimeout_Callback_HangingServer) { + Y_UNIT_TEST(SendTimeout_Callback_HangingServer) { THangingServer server; TObjectCountCheck objectCountCheck; diff --git a/library/cpp/messagebus/test/ut/starter_ut.cpp b/library/cpp/messagebus/test/ut/starter_ut.cpp index dd4d3aaa5e..76d688b62e 100644 --- a/library/cpp/messagebus/test/ut/starter_ut.cpp +++ b/library/cpp/messagebus/test/ut/starter_ut.cpp @@ -7,7 +7,7 @@ using namespace NBus; using namespace NBus::NTest; -Y_UNIT_TEST_SUITE(TBusStarterTest) { +Y_UNIT_TEST_SUITE(TBusStarterTest) { struct TStartJobTestModule: public TExampleModule { using TBusModule::CreateDefaultStarter; @@ -19,21 +19,21 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { } TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); AtomicIncrement(StartCount); job->Sleep(10); return &TStartJobTestModule::End; } TJobHandler End(TBusJob* job, TBusMessage* mess) { - Y_UNUSED(mess); + Y_UNUSED(mess); AtomicIncrement(StartCount); job->Cancel(MESSAGE_UNKNOWN); return nullptr; } }; - Y_UNIT_TEST(Test) { + Y_UNIT_TEST(Test) { TObjectCountCheck objectCountCheck; TBusMessageQueuePtr bus(CreateMessageQueue()); @@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { bus->Stop(); } - Y_UNIT_TEST(TestModuleStartJob) { + Y_UNIT_TEST(TestModuleStartJob) { TObjectCountCheck objectCountCheck; TExampleProtocol proto; @@ -79,7 +79,7 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { TSystemEvent MessageReceivedEvent; TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); MessageReceivedEvent.Signal(); @@ -89,12 +89,12 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { } TJobHandler Never(TBusJob*, TBusMessage*) { - Y_FAIL("happens"); + Y_FAIL("happens"); throw 1; } }; - Y_UNIT_TEST(StartJobDestroyDuringSleep) { + Y_UNIT_TEST(StartJobDestroyDuringSleep) { TObjectCountCheck objectCountCheck; TExampleProtocol proto; @@ -114,7 +114,7 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { TSystemEvent MessageReceivedEvent; TJobHandler Start(TBusJob* job, TBusMessage* mess) override { - Y_UNUSED(mess); + Y_UNUSED(mess); job->SendReply(new TExampleResponse(&Proto.ResponseCount)); @@ -124,7 +124,7 @@ Y_UNIT_TEST_SUITE(TBusStarterTest) { } }; - Y_UNIT_TEST(AllowSendReplyInStarted) { + Y_UNIT_TEST(AllowSendReplyInStarted) { TObjectCountCheck objectCountCheck; TExampleProtocol proto; diff --git a/library/cpp/messagebus/test/ut/sync_client_ut.cpp b/library/cpp/messagebus/test/ut/sync_client_ut.cpp index 400128193f..735aa06569 100644 --- a/library/cpp/messagebus/test/ut/sync_client_ut.cpp +++ b/library/cpp/messagebus/test/ut/sync_client_ut.cpp @@ -50,8 +50,8 @@ namespace NBus { } }; - Y_UNIT_TEST_SUITE(SyncClientTest) { - Y_UNIT_TEST(TestSync) { + Y_UNIT_TEST_SUITE(SyncClientTest) { + Y_UNIT_TEST(TestSync) { TObjectCountCheck objectCountCheck; TExampleServer server; |