Repository navigation
Add end-to-end tests and fix DNS outage while waiting for global envs - #87
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
.ethfallback tomy.dappnode, and the cloaking rules thatentrypoint.shwrites.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.txtexists. dnscrypt-proxy exits with[FATAL] open cloaking-rules.txt: no such file or directory, so DNS is down until the Dappmanager API answers.Approach
entrypoint.shcreatescloaking-rules.txtbefore it starts the background proxy. A restarted container keeps the rules from its previous run.e2e/run.shbuilds the image with the rootdocker-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.privateand.ethforwarding to127.0.0.11.ethnames and their subdomains gettingCNAME my.dappnode.with a 600s TTL, while known names and rules without a fallback keep their normal answerspwa.<domain>resolving viahttps.dappnode.private, for both global envs and/global-envsfrom the APIe2ejob 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
.ethfallback (3 checks fail).Known gap, not addressed here: if
/global-envsreturns JSON withoutDOMAIN,jq -ryields the stringnull, which the entrypoint accepts and writes as a cloaking rule.Test instructions
./e2e/run.shwith Docker, Compose and internet access. It ends with23 passed, 0 failed.E2E_SKIP_INTERNET=1skips the public DNS check,E2E_SKIP_BUILD=1reuses an existing image, andE2E_KEEP=1leaves the containers running.bind/entrypoint.shand run again. "DNS is served while the Dappmanager API is unreachable" and "bind-api logged no fatal errors" fail.