[Coll] Implement get host address in libxgboost. (#9644)
- Port `xgboost.tracker.get_host_ip` in C++.
This commit is contained in:
18
tests/cpp/collective/test_tracker.cc
Normal file
18
tests/cpp/collective/test_tracker.cc
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright 2023, XGBoost Contributors
|
||||
*/
|
||||
#include "../../../src/collective/tracker.h" // for GetHostAddress
|
||||
#include "net_test.h" // for SocketTest
|
||||
|
||||
namespace xgboost::collective {
|
||||
namespace {
|
||||
class TrackerTest : public SocketTest {};
|
||||
} // namespace
|
||||
|
||||
TEST_F(TrackerTest, GetHostAddress) {
|
||||
std::string host;
|
||||
auto rc = GetHostAddress(&host);
|
||||
ASSERT_TRUE(rc.OK());
|
||||
ASSERT_TRUE(host.find("127.") == std::string::npos);
|
||||
}
|
||||
} // namespace xgboost::collective
|
||||
Reference in New Issue
Block a user