aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeffrey Ryan <jeffreyryan@tutanota.com>2022-11-21 15:54:23 -0600
committerJeffrey Ryan <jeffreyryan@tutanota.com>2022-11-21 21:16:16 -0600
commit2c2432245f40377ee31c21e42d34a473f09601fe (patch)
treee94a8b0db6e4cc6c41d55d3c47ade46ca6bb8ead /tests
parentMerge pull request #8594 (diff)
downloadmonero-2c2432245f40377ee31c21e42d34a473f09601fe.tar.xz
DNSResolver: fix not handling hostnames without dot characters [release]
Unrelated, but similar code-wise to #8643. There is a check in `DNSResolver` which automatically fails to resolve hostnames which do not contain the `.` character. This PR removes that check.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/dns_resolver.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit_tests/dns_resolver.cpp b/tests/unit_tests/dns_resolver.cpp
index a6b733592..d56cbe45b 100644
--- a/tests/unit_tests/dns_resolver.cpp
+++ b/tests/unit_tests/dns_resolver.cpp
@@ -158,6 +158,17 @@ TEST(DNSResolver, GetTXTRecord)
EXPECT_STREQ("donate.getmonero.org", addr.c_str());
}
+TEST(DNSResolver, Localhost)
+{
+ tools::DNSResolver resolver = tools::DNSResolver::create();
+
+ bool avail, valid;
+ std::vector<std::string> ips = resolver.get_ipv4("localhost", avail, valid);
+
+ ASSERT_EQ(1, ips.size());
+ ASSERT_EQ("127.0.0.1", ips[0]);
+}
+
bool is_equal(const char *s, const std::vector<std::string> &v) { return v.size() == 1 && v[0] == s; }
TEST(DNS_PUBLIC, empty) { EXPECT_TRUE(tools::dns_utils::parse_dns_public("").empty()); }