Skip to content

Commit cb0d1e7

Browse files
committed
tests: resolve through the local dnsmasq cache in CI.
23ab627 added the cache but dropped the TEST_NGINX_RESOLVER export along with it, so nothing points the tests at 127.0.0.1 any more. Every test file carries its own default: $ENV{TEST_NGINX_RESOLVER} ||= '8.8.8.8'; so nginx's resolver directive goes straight out to a public resolver and the cache only ever serves the warm-up digs. Public resolvers do not answer "localhost" -- RFC 6761 leaves that to the stub resolver -- which is why t/014-bugs.t TEST 37 and t/058-tcp-socket.t TEST 4 fail with "Host not found". Export TEST_NGINX_RESOLVER=127.0.0.1 so queries go through the cache, move dnsmasq to 127.0.0.1:53, and answer the names the resolver tests need from --host-record, since --no-hosts keeps /etc/hosts out. Port 53 keeps the resolver addressable as a bare IP, which t/087-udp-socket.t TEST 10 needs: it passes $TEST_NGINX_RESOLVER to setpeername() with port 53. systemd-resolved's stub listener owns 127.0.0.53:53 only, and --bind-interfaces keeps dnsmasq off every other address. TEST 37 exercises nginx's resolver against a name with a trailing dot, so give it a multi-label name, trailing-dot.test., rather than the single label it used before. The answer still comes from a real DNS server, just a local one.
1 parent a9abc49 commit cb0d1e7

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎.github/workflows/build_and_test.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ jobs:
206206
--bind-interfaces \
207207
--no-resolv --no-hosts \
208208
--host-record=localhost,127.0.0.1,::1 \
209+
--host-record=trailing-dot.test,127.0.0.1 \
209210
--server=8.8.4.4 --server=8.8.8.8 --server=1.1.1.1 \
210211
--cache-size=1000 \
211212
--pid-file=/tmp/dnsmasq.pid

‎t/014-bugs.t‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ ok
884884
--- config
885885
location /t {
886886
resolver $TEST_NGINX_RESOLVER ipv6=off;
887-
set $myhost 'localhost.';
887+
set $myhost 'trailing-dot.test.';
888888
proxy_pass http://$myhost:$TEST_NGINX_RAND_PORT_1/t;
889889
}
890890
--- request

0 commit comments

Comments
 (0)