coredns
The atago project wrote these specs on its own initiative and runs them in its own CI, to exercise atago against a real program. They are not coredns’s official test suite, and the coredns project is not affiliated with atago.
Summary #
1 suite · 5 scenarios
Contents #
- coredns (self-hosted DNS server) — 5 scenarios
coredns (self-hosted DNS server) #
CoreDNS speaks DNS, a protocol atago has no runner
for — which is exactly why this suite exists. A protocol you cannot address
directly is still testable through the client everybody already has: the
real server is booted from an authored Corefile and zone file, and dig
asks it real questions.
What is guaranteed: A and TXT records resolve to the authored values, a CNAME is chased to its target, a name that does not exist comes back NXDOMAIN rather than empty-but-successful, and a name outside the served zone is REFUSED instead of answered. The health plugin is checked over HTTP alongside, so “the process is up” and “the resolver is correct” are pinned separately.
Source: test/e2e/thirdparty/coredns/coredns.atago.yaml
Scenario: the binary reports its version #
When #
coredns -version
Then #
- exit code is
0 - stdout matches
/CoreDNS-[0-9]+\.[0-9]+\.[0-9]+/
Scenario: an authored zone is served authoritatively #
Given #
- Background service
corednsis started:coredns -conf Corefile. - Fixture file
Corefileis created. - Fixture file
zones/example.test.zoneis created.
Inputs #
Fixture Corefile:
example.test:18150 {
bind 127.0.0.1
file zones/example.test.zone
}
Fixture zones/example.test.zone:
$ORIGIN example.test.
@ 3600 IN SOA ns.example.test. admin.example.test. (2026070201 7200 3600 1209600 3600)
@ 3600 IN NS ns.example.test.
ns 3600 IN A 127.0.0.1
www 3600 IN A 192.0.2.10
txt 3600 IN TXT "issued-by=atago"
alias 3600 IN CNAME www.example.test.
When #
dig @127.0.0.1 -p 18150 www.example.test A +noall +comments +answer
dig @127.0.0.1 -p 18150 txt.example.test TXT +short
dig @127.0.0.1 -p 18150 alias.example.test A +short
Then #
- after
dig @127.0.0.1 -p 18150 www.example.test A +noall +comments +answer:- exit code is
0 - stdout contains
status: NOERROR - stdout matches
/flags:[^;]*\baa\b/ - stdout contains
192.0.2.10
- exit code is
- after
dig @127.0.0.1 -p 18150 txt.example.test TXT +short:- exit code is
0 - stdout contains
issued-by=atago
- exit code is
- after
dig @127.0.0.1 -p 18150 alias.example.test A +short:- exit code is
0 - stdout contains
www.example.test.,192.0.2.10
- exit code is
Scenario: missing names and foreign zones get the right RCODEs #
Given #
- Background service
corednsis started:coredns -conf Corefile. - Fixture file
Corefileis created. - Fixture file
zones/example.test.zoneis created.
Inputs #
Fixture Corefile:
example.test:18151 {
bind 127.0.0.1
file zones/example.test.zone
}
Fixture zones/example.test.zone:
$ORIGIN example.test.
@ 3600 IN SOA ns.example.test. admin.example.test. (2026070201 7200 3600 1209600 3600)
@ 3600 IN NS ns.example.test.
ns 3600 IN A 127.0.0.1
www 3600 IN A 192.0.2.10
When #
dig @127.0.0.1 -p 18151 no-such-name.example.test A +noall +comments
dig @127.0.0.1 -p 18151 www.example.com A +noall +comments
Then #
- after
dig @127.0.0.1 -p 18151 no-such-name.example.test A +noall +comments:- exit code is
0 - stdout contains
status: NXDOMAIN
- exit code is
- after
dig @127.0.0.1 -p 18151 www.example.com A +noall +comments:- exit code is
0 - stdout contains
status: REFUSED
- exit code is
Scenario: the health plugin answers over HTTP while DNS serves #
Given #
- Background service
corednsis started:coredns -conf Corefile. - Fixture file
Corefileis created. - Fixture file
zones/example.test.zoneis created.
Inputs #
Fixture Corefile:
example.test:18152 {
bind 127.0.0.1
file zones/example.test.zone
health 127.0.0.1:18153
}
Fixture zones/example.test.zone:
$ORIGIN example.test.
@ 3600 IN SOA ns.example.test. admin.example.test. (2026070201 7200 3600 1209600 3600)
@ 3600 IN NS ns.example.test.
ns 3600 IN A 127.0.0.1
www 3600 IN A 192.0.2.10
When #
# HTTP GET /health
dig @127.0.0.1 -p 18152 www.example.test A +short
Then #
- after
HTTP GET /health:- HTTP status is
200 - body contains
OK
- HTTP status is
- after
dig @127.0.0.1 -p 18152 www.example.test A +short:- exit code is
0 - stdout contains
192.0.2.10
- exit code is
Scenario: a broken Corefile is rejected at startup #
Given #
- Fixture file
Corefileis created.
Inputs #
Fixture Corefile:
example.test:18159 {
no_such_plugin_xyz
}
When #
coredns -conf Corefile
Then #
- exit code is not
0 - stderr contains
Unknown directive 'no_such_plugin_xyz'