aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/testing/unittest/tests_data.cpp
diff options
context:
space:
mode:
authorbulatman <bulatman@yandex-team.ru>2022-02-10 16:45:50 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:50 +0300
commit6560e4993b14d193f8c879e33a3de5e5eba6e21d (patch)
treecfd2e2baa05c3196f2caacbb63c32e1df40bc3de /library/cpp/testing/unittest/tests_data.cpp
parent7489e4682331202b9c7d863c0898eb83d7b12c2b (diff)
downloadydb-6560e4993b14d193f8c879e33a3de5e5eba6e21d.tar.gz
Restoring authorship annotation for <bulatman@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/testing/unittest/tests_data.cpp')
-rw-r--r--library/cpp/testing/unittest/tests_data.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/testing/unittest/tests_data.cpp b/library/cpp/testing/unittest/tests_data.cpp
index b51cbc4b87..d7c7a40a0f 100644
--- a/library/cpp/testing/unittest/tests_data.cpp
+++ b/library/cpp/testing/unittest/tests_data.cpp
@@ -1,59 +1,59 @@
#include "tests_data.h"
#include "registar.h"
-#include <library/cpp/testing/common/network.h>
-
-#include <util/system/env.h>
-#include <util/system/mutex.h>
+#include <library/cpp/testing/common/network.h>
+#include <util/system/env.h>
+#include <util/system/mutex.h>
+
class TPortManager::TPortManagerImpl {
public:
- TPortManagerImpl(bool reservePortsForCurrentTest)
- : EnableReservePortsForCurrentTest(reservePortsForCurrentTest)
- , DisableRandomPorts(!GetEnv("NO_RANDOM_PORTS").empty())
+ TPortManagerImpl(bool reservePortsForCurrentTest)
+ : EnableReservePortsForCurrentTest(reservePortsForCurrentTest)
+ , DisableRandomPorts(!GetEnv("NO_RANDOM_PORTS").empty())
{
}
ui16 GetPort(ui16 port) {
- if (port && DisableRandomPorts) {
+ if (port && DisableRandomPorts) {
return port;
}
- TAtomicSharedPtr<NTesting::IPort> holder(NTesting::GetFreePort().Release());
- ReservePortForCurrentTest(holder);
+ TAtomicSharedPtr<NTesting::IPort> holder(NTesting::GetFreePort().Release());
+ ReservePortForCurrentTest(holder);
- TGuard<TMutex> g(Lock);
- ReservedPorts.push_back(holder);
- return holder->Get();
- }
+ TGuard<TMutex> g(Lock);
+ ReservedPorts.push_back(holder);
+ return holder->Get();
+ }
- ui16 GetUdpPort(ui16 port) {
- return GetPort(port);
- }
+ ui16 GetUdpPort(ui16 port) {
+ return GetPort(port);
+ }
- ui16 GetTcpPort(ui16 port) {
- return GetPort(port);
+ ui16 GetTcpPort(ui16 port) {
+ return GetPort(port);
}
ui16 GetTcpAndUdpPort(ui16 port) {
- return GetPort(port);
+ return GetPort(port);
}
ui16 GetPortsRange(const ui16 startPort, const ui16 range) {
- Y_UNUSED(startPort);
- auto ports = NTesting::NLegacy::GetFreePortsRange(range);
- ui16 first = ports[0];
+ Y_UNUSED(startPort);
+ auto ports = NTesting::NLegacy::GetFreePortsRange(range);
+ ui16 first = ports[0];
TGuard<TMutex> g(Lock);
- for (auto& port : ports) {
- ReservedPorts.emplace_back(port.Release());
- ReservePortForCurrentTest(ReservedPorts.back());
+ for (auto& port : ports) {
+ ReservedPorts.emplace_back(port.Release());
+ ReservePortForCurrentTest(ReservedPorts.back());
}
- return first;
+ return first;
}
private:
- void ReservePortForCurrentTest(const TAtomicSharedPtr<NTesting::IPort>& portGuard) {
- if (EnableReservePortsForCurrentTest) {
+ void ReservePortForCurrentTest(const TAtomicSharedPtr<NTesting::IPort>& portGuard) {
+ if (EnableReservePortsForCurrentTest) {
TTestBase* currentTest = NUnitTest::NPrivate::GetCurrentTest();
if (currentTest != nullptr) {
currentTest->RunAfterTest([guard = portGuard]() mutable {
@@ -65,13 +65,13 @@ private:
private:
TMutex Lock;
- TVector<TAtomicSharedPtr<NTesting::IPort>> ReservedPorts;
- const bool EnableReservePortsForCurrentTest;
- const bool DisableRandomPorts;
+ TVector<TAtomicSharedPtr<NTesting::IPort>> ReservedPorts;
+ const bool EnableReservePortsForCurrentTest;
+ const bool DisableRandomPorts;
};
-TPortManager::TPortManager(bool reservePortsForCurrentTest)
- : Impl_(new TPortManagerImpl(reservePortsForCurrentTest))
+TPortManager::TPortManager(bool reservePortsForCurrentTest)
+ : Impl_(new TPortManagerImpl(reservePortsForCurrentTest))
{
}
@@ -99,6 +99,6 @@ ui16 TPortManager::GetPortsRange(const ui16 startPort, const ui16 range) {
}
ui16 GetRandomPort() {
- TPortManager* pm = Singleton<TPortManager>(false);
+ TPortManager* pm = Singleton<TPortManager>(false);
return pm->GetPort();
}