Skip to content

Commit

Permalink
ports intersection check (ydb-platform#4706)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorooleg authored and MrLolthe1st committed May 28, 2024
1 parent 612777b commit f728f4e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ydb/tests/fq/control_plane_storage/ydb_test_bootstrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ inline void AssertNoTopSort(TDebugInfoPtr debugInfo) {
}
}

namespace {

TString Exec(const TString& cmd) {
std::array<char, 128> buffer;
TString result;
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(), "r"), pclose);
if (!pipe) {
throw std::runtime_error("popen() failed!");
}
while (fgets(buffer.data(), static_cast<int>(buffer.size()), pipe.get()) != nullptr) {
result += buffer.data();
}
return result;
}

}

struct TTestBootstrap {
NConfig::TControlPlaneStorageConfig Config;
NFq::TYqSharedResources::TPtr YqSharedResources;
Expand All @@ -79,6 +96,9 @@ struct TTestBootstrap {
TTestBootstrap(std::string tablePrefix, const NConfig::TControlPlaneStorageConfig& config = {})
: Config(config)
{
Cerr << "Netstat: " << Exec("netstat --all --program") << Endl;
Cerr << "Process stat: " << Exec("ps aux") << Endl;
Cerr << "YDB receipt endpoint: " << GetEnv("YDB_ENDPOINT") << ", database: " << GetEnv("YDB_DATABASE") << Endl;
tablePrefix.erase(std::remove_if(tablePrefix.begin(), tablePrefix.end(), isspace), tablePrefix.end());
TablePrefix = tablePrefix;
auto& storageConfig = *Config.MutableStorage();
Expand Down

0 comments on commit f728f4e

Please sign in to comment.