aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/test
diff options
context:
space:
mode:
authorAlexander Gololobov <davenger@yandex-team.com>2022-02-10 16:47:38 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:38 +0300
commitfccc62e9bfdce9be2fe7e0f23479da3a5512211a (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/messagebus/test
parent39608cdb86363c75ce55b2b9a69841c3b71f22cf (diff)
downloadydb-fccc62e9bfdce9be2fe7e0f23479da3a5512211a.tar.gz
Restoring authorship annotation for Alexander Gololobov <davenger@yandex-team.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/messagebus/test')
-rw-r--r--library/cpp/messagebus/test/ut/messagebus_ut.cpp70
-rw-r--r--library/cpp/messagebus/test/ut/one_way_ut.cpp20
2 files changed, 45 insertions, 45 deletions
diff --git a/library/cpp/messagebus/test/ut/messagebus_ut.cpp b/library/cpp/messagebus/test/ut/messagebus_ut.cpp
index e771a933ca..040f9b7702 100644
--- a/library/cpp/messagebus/test/ut/messagebus_ut.cpp
+++ b/library/cpp/messagebus/test/ut/messagebus_ut.cpp
@@ -313,9 +313,9 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
TMutex Lock_;
TDeque<TAutoPtr<TOnMessageContext>> DelayedMessages;
- TDelayReplyServer()
- : MessageReceivedEvent(TEventResetType::rAuto)
- {
+ TDelayReplyServer()
+ : MessageReceivedEvent(TEventResetType::rAuto)
+ {
Bus = CreateMessageQueue("TDelayReplyServer");
TBusServerSessionConfig sessionConfig;
sessionConfig.SendTimeout = 1000;
@@ -617,30 +617,30 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
}
Y_UNIT_TEST(ServerMessageReservedIds) {
- TObjectCountCheck objectCountCheck;
-
- TExampleServer server;
- TNetAddr serverAddr = server.GetActualListenAddr();
-
- TExampleClient client;
-
- client.SendMessagesWaitReplies(2, serverAddr);
-
- // This test doens't check 0, 1, YBUS_KEYINVALID because there are asserts() on sending side
-
- TAutoPtr<TBusMessage> req(new TExampleRequest(&client.Proto.RequestCount));
- req->GetHeader()->Id = 2;
- client.Session->SendMessageAutoPtr(req, &serverAddr);
- client.MessageCount = 1;
- client.WaitForError(MESSAGE_DELIVERY_FAILED);
-
- req.Reset(new TExampleRequest(&client.Proto.RequestCount));
- req->GetHeader()->Id = YBUS_KEYLOCAL;
- client.Session->SendMessageAutoPtr(req, &serverAddr);
- client.MessageCount = 1;
- client.WaitForError(MESSAGE_DELIVERY_FAILED);
- }
-
+ TObjectCountCheck objectCountCheck;
+
+ TExampleServer server;
+ TNetAddr serverAddr = server.GetActualListenAddr();
+
+ TExampleClient client;
+
+ client.SendMessagesWaitReplies(2, serverAddr);
+
+ // This test doens't check 0, 1, YBUS_KEYINVALID because there are asserts() on sending side
+
+ TAutoPtr<TBusMessage> req(new TExampleRequest(&client.Proto.RequestCount));
+ req->GetHeader()->Id = 2;
+ client.Session->SendMessageAutoPtr(req, &serverAddr);
+ client.MessageCount = 1;
+ client.WaitForError(MESSAGE_DELIVERY_FAILED);
+
+ req.Reset(new TExampleRequest(&client.Proto.RequestCount));
+ req->GetHeader()->Id = YBUS_KEYLOCAL;
+ client.Session->SendMessageAutoPtr(req, &serverAddr);
+ client.MessageCount = 1;
+ client.WaitForError(MESSAGE_DELIVERY_FAILED);
+ }
+
Y_UNIT_TEST(TestGetInFlightForDestination) {
TObjectCountCheck objectCountCheck;
@@ -661,7 +661,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
break;
}
}
- UNIT_ASSERT_VALUES_EQUAL(server.GetDelayedMessageCount(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(server.GetDelayedMessageCount(), 2);
size_t inFlight = client.Session->GetInFlight(addr);
// 4 is for messagebus1 that adds inFlight counter twice for some reason
@@ -731,10 +731,10 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
// check reset is possible here
message->Reset();
- // intentionally don't destroy the message
- // we will try to resend it
+ // intentionally don't destroy the message
+ // we will try to resend it
Y_UNUSED(message.Release());
-
+
TestSync.CheckAndIncrement(1);
}
};
@@ -760,8 +760,8 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
// check reset is possible here
message->Reset();
client.TestSync.CheckAndIncrement(3);
-
- delete message;
+
+ delete message;
}
Y_UNIT_TEST(ResetAfterSendOneWayErrorInReturn) {
@@ -865,8 +865,8 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
request.SetVersionInternal(0xF); // max
output.Write(&request, sizeof(request));
- UNIT_ASSERT_VALUES_EQUAL(IsVersionNegotiation(request), true);
-
+ UNIT_ASSERT_VALUES_EQUAL(IsVersionNegotiation(request), true);
+
TStreamSocketInput input(&socket);
TBusHeader response;
diff --git a/library/cpp/messagebus/test/ut/one_way_ut.cpp b/library/cpp/messagebus/test/ut/one_way_ut.cpp
index bc78c5238a..9c21227e2b 100644
--- a/library/cpp/messagebus/test/ut/one_way_ut.cpp
+++ b/library/cpp/messagebus/test/ut/one_way_ut.cpp
@@ -93,7 +93,7 @@ public:
TExampleProtocol Proto;
public:
- TAtomic NumMessages;
+ TAtomic NumMessages;
NullServer() {
NumMessages = 0;
@@ -119,7 +119,7 @@ public:
/// tell session to forget this message and never expect any reply
mess.ForgetRequest();
- AtomicIncrement(NumMessages);
+ AtomicIncrement(NumMessages);
}
/// this handler should not be called because this server does not send replies
@@ -139,10 +139,10 @@ Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) {
client.Work();
// wait until all client message are delivered
- UNIT_WAIT_FOR(AtomicGet(server.NumMessages) == 10);
+ UNIT_WAIT_FOR(AtomicGet(server.NumMessages) == 10);
// assert correct number of messages
- UNIT_ASSERT_VALUES_EQUAL(AtomicGet(server.NumMessages), 10);
+ UNIT_ASSERT_VALUES_EQUAL(AtomicGet(server.NumMessages), 10);
UNIT_ASSERT_VALUES_EQUAL(server.Session->GetInFlight(), 0);
UNIT_ASSERT_VALUES_EQUAL(client.Session->GetInFlight(), 0);
}
@@ -196,7 +196,7 @@ Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) {
TBusClientSessionConfig sessionConfig;
sessionConfig.SendTimeout = 1;
sessionConfig.ConnectTimeout = 1;
- sessionConfig.Secret.TimeoutPeriod = TDuration::MilliSeconds(10);
+ sessionConfig.Secret.TimeoutPeriod = TDuration::MilliSeconds(10);
return sessionConfig;
}
@@ -245,11 +245,11 @@ Y_UNIT_TEST_SUITE(TMessageBusTests_OneWay) {
first = false;
}
- // BUGBUG: The test is buggy: the client might not get any error when sending one-way messages.
- // All the messages that the client has sent before he gets first MESSAGE_BUSY error might get
- // serailized and written to the socket buffer, so the write queue gets drained and there are
- // no messages to timeout when periodic timeout check happens.
-
+ // BUGBUG: The test is buggy: the client might not get any error when sending one-way messages.
+ // All the messages that the client has sent before he gets first MESSAGE_BUSY error might get
+ // serailized and written to the socket buffer, so the write queue gets drained and there are
+ // no messages to timeout when periodic timeout check happens.
+
client.GotError.WaitI();
}
}