Skip to content

Add end-to-end tests and fix DNS outage while waiting for global envs - #87

Merged
3alpha merged 3 commits into
masterfrom
test/e2e-dns
Nov 23, 2026
Merged

3alpha merged 3 commits into
masterfrom
test/e2e-dns

Conversation

@3alpha

@3alpha 3alpha commented Nov 23, 2026

Copy link
Copy Markdown
Member

Context

The package has no tests that run the built image, so the Dappnode-specific DNS behaviour was only covered by the Go unit tests for the forwarding patch. That behaviour is the forwarding rules, the .eth fallback to my.dappnode, and the cloaking rules that entrypoint.sh writes.

Writing the e2e suite uncovered a bug. When the domain and internal IP are not available as global envs, the entrypoint starts dnscrypt-proxy in the background before cloaking-rules.txt exists. dnscrypt-proxy exits with [FATAL] open cloaking-rules.txt: no such file or directory, so DNS is down until the Dappmanager API answers.

Approach

  • Fix: entrypoint.sh creates cloaking-rules.txt before it starts the background proxy. A restarted container keeps the rules from its previous run.
  • E2E suite: e2e/run.sh builds the image with the root docker-compose.yml, which also runs the Go tests. It then starts two instances of the package on an isolated network, one with global envs and one that polls a mock Dappmanager started later. Docker's embedded DNS resolves stand-in Dappnode services and checks:
    • .dappnode, .dappnode.private and .eth forwarding to 127.0.0.11
    • unknown .eth names and their subdomains getting CNAME my.dappnode. with a 600s TTL, while known names and rules without a fallback keep their normal answers
    • the domain cloaked to the internal IP, and pwa.<domain> resolving via https.dappnode.private, for both global envs and /global-envs from the API
    • DNS staying available while the API is unreachable, and forwarding and the fallback still working after the proxy restart
    • public names resolving through the configured upstream resolvers, and no fatal errors in the logs
  • CI: a new e2e job runs the suite on pull requests.

To check that the suite catches regressions, I ran it against the original entrypoint (2 checks fail) and against forwarding rules without the .eth fallback (3 checks fail).

Known gap, not addressed here: if /global-envs returns JSON without DOMAIN, jq -r yields the string null, which the entrypoint accepts and writes as a cloaking rule.

Test instructions

  1. Run ./e2e/run.sh with Docker, Compose and internet access. It ends with 23 passed, 0 failed.
  2. Optional flags: E2E_SKIP_INTERNET=1 skips the public DNS check, E2E_SKIP_BUILD=1 reuses an existing image, and E2E_KEEP=1 leaves the containers running.
  3. To see the bug, revert bind/entrypoint.sh and run again. "DNS is served while the Dappmanager API is unreachable" and "bind-api logged no fatal errors" fail.

dnscrypt-proxy exits when cloaking-rules.txt is missing, so on a fresh
container without global envs the background proxy died immediately and
DNS stayed down until the Dappmanager API answered.
Run the package image on an isolated Docker network with mock Dappnode
services and check the forwarding rules, the .eth fallback from the
Dappnode patch, and the cloaking rules written by entrypoint.sh from
global envs or the Dappmanager API. Run the suite in CI on pull requests.
@3alpha
3alpha requested a review from a team as a code owner November 23, 2026 08:09
@3alpha
3alpha merged commit 2b7e724 into master Nov 23, 2026
5 checks passed
@3alpha
3alpha deleted the test/e2e-dns branch November 23, 2026 08:12
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.

1 participant