Fix QDnsLookup autotest failure in CI environment
The DNS server can legitimately include NS and A records for the authoritative name server in addition to the DNS records that were requested. These are now ignored when checking the reply (we only check results that match the query, rather than failing if a result is for a different host name than the query). Task-number: QTBUG-24698 Change-Id: I327f31d58cdca50c7df6b32b275d7f28b56405f0 Reviewed-by: Jeremy Lainé <jeremy.laine@m4x.org> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
This commit is contained in:
parent
7046188bc6
commit
8a811865ab
@ -159,8 +159,9 @@ void tst_QDnsLookup::lookup()
|
||||
const QString hostName = cname.isEmpty() ? domain : cname;
|
||||
QStringList addresses;
|
||||
foreach (const QDnsHostAddressRecord &record, lookup.hostAddressRecords()) {
|
||||
QCOMPARE(record.name(), hostName);
|
||||
addresses << record.value().toString().toLower();
|
||||
//reply may include A & AAAA records for nameservers, ignore them and only look at records matching the query
|
||||
if (record.name() == hostName)
|
||||
addresses << record.value().toString().toLower();
|
||||
}
|
||||
addresses.sort();
|
||||
QCOMPARE(addresses.join(" "), host);
|
||||
@ -176,8 +177,9 @@ void tst_QDnsLookup::lookup()
|
||||
// name servers
|
||||
QStringList nameServers;
|
||||
foreach (const QDnsDomainNameRecord &record, lookup.nameServerRecords()) {
|
||||
QCOMPARE(record.name(), domain);
|
||||
nameServers << record.value();
|
||||
//reply may include NS records for authoritative nameservers, ignore them and only look at records matching the query
|
||||
if (record.name() == domain)
|
||||
nameServers << record.value();
|
||||
}
|
||||
nameServers.sort();
|
||||
QCOMPARE(nameServers.join(" "), ns);
|
||||
|
Loading…
x
Reference in New Issue
Block a user