Skip to content

Commit e59b451

Browse files
committed
[coro_rpc] fix test in windows local ip
1 parent ddc2dc2 commit e59b451

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/coro_rpc/tests/test_coro_rpc_client.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,16 @@ TEST_CASE("testing client with local ip") {
220220

221221
std::string local_ip = get_first_local_ip();
222222
ELOG_INFO << "local ip: " << local_ip;
223+
224+
// Due to windows strong host mode, we cant connect to localhost from specify
225+
// nic ip address
226+
#ifndef _WIN32
227+
std::string target_ip = "127.0.0.1";
228+
#else
229+
std::string target_ip = local_ip;
230+
#endif
223231
coro_rpc_client client(local_ip);
224-
auto ec = client.sync_connect("127.0.0.1", "8901");
232+
auto ec = client.sync_connect(target_ip, "8901");
225233
REQUIRE_MESSAGE(!ec, ec.message());
226234

227235
auto ret = client.sync_call<hello>();

0 commit comments

Comments
 (0)