aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/test/ut/messagebus_ut.cpp
diff options
context:
space:
mode:
authorvegayours <vegayours@yandex-team.ru>2022-02-10 16:50:31 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:31 +0300
commitb9b7aa7f3855cbc4d6cd032a89adbc25e680a4df (patch)
tree84d4a0f0857da118debdb9684b64ab00acb42206 /library/cpp/messagebus/test/ut/messagebus_ut.cpp
parentb1683877992937b1040baa621c4b216ed8405729 (diff)
downloadydb-b9b7aa7f3855cbc4d6cd032a89adbc25e680a4df.tar.gz
Restoring authorship annotation for <vegayours@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/messagebus/test/ut/messagebus_ut.cpp')
-rw-r--r--library/cpp/messagebus/test/ut/messagebus_ut.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/library/cpp/messagebus/test/ut/messagebus_ut.cpp b/library/cpp/messagebus/test/ut/messagebus_ut.cpp
index 040f9b7702..a549e716d1 100644
--- a/library/cpp/messagebus/test/ut/messagebus_ut.cpp
+++ b/library/cpp/messagebus/test/ut/messagebus_ut.cpp
@@ -130,12 +130,12 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
: TExampleClient(std::forward<Args>(args)...)
{
}
-
+
~TestNoServerImplClient() override {
Session->Shutdown();
}
- void OnError(TAutoPtr<TBusMessage> message, EMessageStatus status) override {
+ 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());
@@ -1066,8 +1066,8 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
TNetAddr noServerAddr("localhost", 17);
TBusClientSessionConfig clientConfig;
- clientConfig.RetryInterval = 100;
- TestNoServerImplClient client(clientConfig);
+ clientConfig.RetryInterval = 100;
+ TestNoServerImplClient client(clientConfig);
int count = 0;
for (; count < 10; ++count) {
@@ -1098,9 +1098,9 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
TNetAddr noServerAddr("localhost", 17);
TBusClientSessionConfig clientConfig;
- clientConfig.RetryInterval = 100;
- clientConfig.ReconnectWhenIdle = false;
- TestNoServerImplClient client(clientConfig);
+ clientConfig.RetryInterval = 100;
+ clientConfig.ReconnectWhenIdle = false;
+ TestNoServerImplClient client(clientConfig);
int count = 0;
for (; count < 10; ++count) {
@@ -1114,38 +1114,38 @@ Y_UNIT_TEST_SUITE(TMessageBusTests) {
UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2);
}
- Sleep(TDuration::MilliSeconds(clientConfig.RetryInterval / 2));
+ Sleep(TDuration::MilliSeconds(clientConfig.RetryInterval / 2));
UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2);
- Sleep(TDuration::MilliSeconds(10 * clientConfig.RetryInterval));
+ Sleep(TDuration::MilliSeconds(10 * clientConfig.RetryInterval));
UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2);
};
-
+
Y_UNIT_TEST(TestConnectionAttemptsOnNoMessagesAndReconnectWhenIdle) {
- TObjectCountCheck objectCountCheck;
-
- TNetAddr noServerAddr("localhost", 17);
- TBusClientSessionConfig clientConfig;
- clientConfig.ReconnectWhenIdle = true;
- clientConfig.RetryInterval = 100;
- TestNoServerImplClient client(clientConfig);
-
- int count = 0;
- for (; count < 10; ++count) {
- EMessageStatus status = client.Session->SendMessageOneWay(new TExampleRequest(&client.Proto.RequestCount),
- &noServerAddr);
-
+ TObjectCountCheck objectCountCheck;
+
+ TNetAddr noServerAddr("localhost", 17);
+ TBusClientSessionConfig clientConfig;
+ clientConfig.ReconnectWhenIdle = true;
+ clientConfig.RetryInterval = 100;
+ TestNoServerImplClient client(clientConfig);
+
+ int count = 0;
+ for (; count < 10; ++count) {
+ 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());
- client.TestSync.WaitForAndIncrement(count * 2 + 1);
-
- // First connection attempt is for connect call; second one is to get connect result.
- UNIT_ASSERT_VALUES_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2);
- }
-
- Sleep(TDuration::MilliSeconds(clientConfig.RetryInterval / 2));
- UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2);
- Sleep(TDuration::MilliSeconds(10 * clientConfig.RetryInterval));
- // it is undeterministic how many reconnects will be during that amount of time
- // but it should occur at least once
- UNIT_ASSERT(client.Session->GetConnectSyscallsNumForTest(noServerAddr) > 2);
- };
+ client.TestSync.WaitForAndIncrement(count * 2 + 1);
+
+ // First connection attempt is for connect call; second one is to get connect result.
+ UNIT_ASSERT_VALUES_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2);
+ }
+
+ Sleep(TDuration::MilliSeconds(clientConfig.RetryInterval / 2));
+ UNIT_ASSERT_EQUAL(client.Session->GetConnectSyscallsNumForTest(noServerAddr), 2);
+ Sleep(TDuration::MilliSeconds(10 * clientConfig.RetryInterval));
+ // it is undeterministic how many reconnects will be during that amount of time
+ // but it should occur at least once
+ UNIT_ASSERT(client.Session->GetConnectSyscallsNumForTest(noServerAddr) > 2);
+ };
};