Skip to content

tests: resolve through the local dnsmasq cache in CI. - #2528

Merged
zhuizhuhaomeng merged 1 commit into
openresty:masterfrom
u5surf:ci-dnsmasq-resolver
Sep 17, 2026
Merged

zhuizhuhaomeng merged 1 commit into
openresty:masterfrom
u5surf:ci-dnsmasq-resolver

Conversation

@u5surf

@u5surf u5surf commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Fixes the localhost could not be resolved (3: Host not found) failures in t/014-bugs.t TEST 37 and t/058-tcp-socket.t TEST 4, which are red on master today.

Root cause

#2499 added the dnsmasq cache but removed export TEST_NGINX_RESOLVER=8.8.4.4 without putting the cache's address in its place. Nothing sets that variable in CI any more, so each test file falls back to its own default:

$ENV{TEST_NGINX_RESOLVER} ||= '8.8.8.8';

nginx's resolver directive therefore queries a public resolver directly and the cache only ever serves the warm-up digs. Public resolvers do not answer localhost — RFC 6761 leaves that to the stub resolver — hence "Host not found".

Fix

  • export TEST_NGINX_RESOLVER=127.0.0.1, so queries actually go through the cache.
  • Move dnsmasq to 127.0.0.1:53 and answer the names the resolver tests need with --host-record, since --no-hosts keeps /etc/hosts out.

Port 53 matters: t/087-udp-socket.t TEST 10 hands $TEST_NGINX_RESOLVER to setpeername() with port 53, so the resolver has to stay addressable as a bare IP. systemd-resolved's stub listener owns 127.0.0.53:53 only, and --bind-interfaces keeps dnsmasq off every other address. The step now fails loudly if dnsmasq is not listening there.

TEST 37 and the trailing dot

TEST 37 was added in 5581ded to exercise nginx's resolver against a domain name ending in a dot, so it deserves a name that looks like a real FQDN. It now resolves trailing-dot.test. — multiple labels plus the trailing dot — served from a --host-record on the local dnsmasq, instead of the single-label localhost. it used before. The answer still comes from a real DNS server, just a local one rather than a third party. This follows from the discussion in #2523.

Relationship to #2523

#2523 fixes the same two tests by resolving 127.0.0.1.sslip.io instead of localhost. That trades a dependency on public DNS answering localhost for a dependency on a third-party wildcard DNS service being up and reachable from the runners, which is the direction #2499 moved away from. This patch keeps the resolution local instead.

The rest of #2523 — the --- wait and --max-time adjustments in t/024-access/on-abort.t, t/128-duplex-tcp-socket.t and t/189-http2-subreq-error-wakeup.t — addresses different flakes and does not overlap with this change.

I hereby granted the copyright of the changes in this pull request
to the authors of this lua-nginx-module project.

@u5surf
u5surf force-pushed the ci-dnsmasq-resolver branch from cb0d1e7 to 1d054f9 Compare September 16, 2026 12:01
@u5surf
u5surf force-pushed the ci-dnsmasq-resolver branch from 1d054f9 to 3b8c8a5 Compare September 16, 2026 12:09
@zhuizhuhaomeng
zhuizhuhaomeng merged commit 77e749a into openresty:master Sep 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants