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) #

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 Network policy: egress is allowed only to 127.0.0.1.

Scenario: the binary reports its version #

only when coredns -version succeeds

When #

coredns -version

Then #

  • exit code is 0
  • stdout matches /CoreDNS-[0-9]+\.[0-9]+\.[0-9]+/

Scenario: an authored zone is served authoritatively #

only when coredns -version succeeds

Given #

  • Background service coredns is started: coredns -conf Corefile.
  • Fixture file Corefile is created.
  • Fixture file zones/example.test.zone is 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
  • after dig @127.0.0.1 -p 18150 txt.example.test TXT +short:
    • exit code is 0
    • stdout contains issued-by=atago
  • 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

Scenario: missing names and foreign zones get the right RCODEs #

only when coredns -version succeeds

Given #

  • Background service coredns is started: coredns -conf Corefile.
  • Fixture file Corefile is created.
  • Fixture file zones/example.test.zone is 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
  • after dig @127.0.0.1 -p 18151 www.example.com A +noall +comments:
    • exit code is 0
    • stdout contains status: REFUSED

Scenario: the health plugin answers over HTTP while DNS serves #

only when coredns -version succeeds

Given #

  • Background service coredns is started: coredns -conf Corefile.
  • Fixture file Corefile is created.
  • Fixture file zones/example.test.zone is created.
  • The step is retried up to 15 times every 500ms until HTTP status is 200.

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 via 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
  • after dig @127.0.0.1 -p 18152 www.example.test A +short:
    • exit code is 0
    • stdout contains 192.0.2.10

Scenario: a broken Corefile is rejected at startup #

only when coredns -version succeeds

Given #

  • Fixture file Corefile is 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'