Files
David Evans c558c8e81a dns: add tests for ENODATA states
This adds new tests to codify the existing behaviour of throwing
ENODATA when there are no matching DNS records.

It also updates an existing test which was broken by
https://github.com/nodejs/node/pull/64355 - previously requesting
DNS records for a domain which has a CNAME to another domain,
neither of which contain the requested type of record, would return
an empty array. Since #64355, it will instead throw ENODATA.

Finally, this updates the trigger for the relevant pipeline so that
the internet tests will run if the cares_wrap.cc (and various other
related files) are changed, which should reduce the chance of
similar changes breaking main in the future.

Refs: https://github.com/nodejs/node/pull/64355
Signed-off-by: David Evans <davidje13@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/64624
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Tim Perry <pimterry@gmail.com>
2026-07-24 09:57:13 +00:00

65 lines
2.1 KiB
JavaScript

'use strict';
// Utilities for internet-related tests
const addresses = {
// A generic host that has registered common DNS records,
// supports both IPv4 and IPv6, and provides basic HTTP/HTTPS services
INET_HOST: 'nodejs.org',
// A host that provides IPv4 services
INET4_HOST: 'nodejs.org',
// A host that provides IPv6 services
INET6_HOST: 'nodejs.org',
// An accessible IPv4 IP,
// defaults to the Google Public DNS IPv4 address
INET4_IP: '8.8.8.8',
// An accessible IPv6 IP,
// defaults to the Google Public DNS IPv6 address
INET6_IP: '2001:4860:4860::8888',
// An invalid host that cannot be resolved
// See https://tools.ietf.org/html/rfc2606#section-2
INVALID_HOST: 'something.invalid',
// A host with MX records registered
MX_HOST: 'nodejs.org',
// On some systems, .invalid returns a server failure/try again rather than
// record not found. Use this to guarantee record not found.
NOT_FOUND: 'come.on.fhqwhgads.test',
// A host with SRV records registered
SRV_HOST: '_caldav._tcp.google.com',
// A host with PTR records registered
PTR_HOST: '8.8.8.8.in-addr.arpa',
// A host with NAPTR records registered
NAPTR_HOST: 'sip2sip.info',
// A host with SOA records registered
SOA_HOST: 'nodejs.org',
// A host with CAA record registered
CAA_HOST: 'google.com',
// A host with CNAME records registered
CNAME_HOST: 'blog.nodejs.org',
// A host with NS records registered
NS_HOST: 'nodejs.org',
// A host with TLSA records registered
TLSA_HOST: '_443._tcp.fedoraproject.org',
// A host with TXT records registered
TXT_HOST: 'nodejs.org',
// An accessible IPv4 DNS server
DNS4_SERVER: '8.8.8.8',
// An accessible IPv4 DNS server
DNS6_SERVER: '2001:4860:4860::8888',
// A valid host with no records (except SOA)
NO_RECORD_HOST: 'void.example.com',
// A valid host with no TXT records, and a CNAME to a host with no TXT records
CNAME_TO_NO_TXT_HOST: 'www.microsoft.com',
};
for (const key of Object.keys(addresses)) {
const envName = `NODE_TEST_${key}`;
if (process.env[envName]) {
addresses[key] = process.env[envName];
}
}
module.exports = {
addresses,
};