Skip to content

Commit b108b00

Browse files
committed
fix tests [20] --filter=[core]
1 parent 4adb5ce commit b108b00

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

core-tests/src/network/dns.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ TEST(dns, domain_not_found) {
5454
TEST(dns, bad_family) {
5555
test::coroutine::run([](void *arg) {
5656
auto list = swoole::coroutine::dns_lookup("www.google.com", 9999, 2);
57-
ASSERT_GE(list.size(), 1);
57+
ASSERT_EQ(list.size(), 0);
58+
ASSERT_ERREQ(SW_ERROR_DNSLOOKUP_RESOLVE_FAILED);
5859
});
5960
}
6061

src/network/dns.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ std::string gethostbyname(int type, const std::string &name) {
770770
if (gethostbyname(type, name.c_str(), addr) == SW_OK) {
771771
return Address::addr_str(type, addr);
772772
}
773+
swoole_set_last_error(SW_ERROR_DNSLOOKUP_RESOLVE_FAILED);
773774
return {};
774775
}
775776

0 commit comments

Comments
 (0)