Skip to content

Commit 4b411f4

Browse files
authored
ports intersection check (#4706)
1 parent 6d272ba commit 4b411f4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ydb/tests/fq/control_plane_storage/ydb_test_bootstrap.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ inline void AssertNoTopSort(TDebugInfoPtr debugInfo) {
6262
}
6363
}
6464

65+
namespace {
66+
67+
TString Exec(const TString& cmd) {
68+
std::array<char, 128> buffer;
69+
TString result;
70+
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(), "r"), pclose);
71+
if (!pipe) {
72+
throw std::runtime_error("popen() failed!");
73+
}
74+
while (fgets(buffer.data(), static_cast<int>(buffer.size()), pipe.get()) != nullptr) {
75+
result += buffer.data();
76+
}
77+
return result;
78+
}
79+
80+
}
81+
6582
struct TTestBootstrap {
6683
NConfig::TControlPlaneStorageConfig Config;
6784
NFq::TYqSharedResources::TPtr YqSharedResources;
@@ -79,6 +96,9 @@ struct TTestBootstrap {
7996
TTestBootstrap(std::string tablePrefix, const NConfig::TControlPlaneStorageConfig& config = {})
8097
: Config(config)
8198
{
99+
Cerr << "Netstat: " << Exec("netstat --all --program") << Endl;
100+
Cerr << "Process stat: " << Exec("ps aux") << Endl;
101+
Cerr << "YDB receipt endpoint: " << GetEnv("YDB_ENDPOINT") << ", database: " << GetEnv("YDB_DATABASE") << Endl;
82102
tablePrefix.erase(std::remove_if(tablePrefix.begin(), tablePrefix.end(), isspace), tablePrefix.end());
83103
TablePrefix = tablePrefix;
84104
auto& storageConfig = *Config.MutableStorage();

0 commit comments

Comments
 (0)