mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 20:02:05 +00:00
Fix test local address
This commit is contained in:
parent
914b3776d4
commit
b91b90d639
@ -10,11 +10,16 @@ TEST(LocalAddress, SmokeTest)
|
||||
DB::ShellCommand::Config config("/bin/hostname");
|
||||
config.arguments = {"-i"};
|
||||
auto cmd = DB::ShellCommand::executeDirect(config);
|
||||
|
||||
std::string address_str;
|
||||
DB::readString(address_str, cmd->out);
|
||||
cmd->wait();
|
||||
std::cerr << "Got Address: " << address_str << std::endl;
|
||||
|
||||
/// hostname -i can return more than one address: "2001:db8:1::242:ac11:2 172.17.0.2"
|
||||
if (auto space_pos = address_str.find(' '); space_pos != std::string::npos)
|
||||
address_str = address_str.substr(0, space_pos);
|
||||
|
||||
Poco::Net::IPAddress address(address_str);
|
||||
|
||||
EXPECT_TRUE(DB::isLocalAddress(address));
|
||||
|
Loading…
Reference in New Issue
Block a user