Repository navigation
test(e2e): name DMS auth as the cause of the health route's 500 with MongoDB down - #222
Merged
Merged
Conversation
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.
Why
Wdf26acfc-150. With MongoDB down, the Overview should report the connection as down within the probe's 3 s deadline. Today
GET /api/database/healthanswers 500 after 30 s. The journey's knownFailures entry blamedgetOverviewHealthfor reading totals after a failed probe. A run with a log at the route's entry shows the route never runs: DMS auth fails first.What changes
The knownFailures reason of
an-unreachable-database-shows-unavailable-and-check-again-recoversine2e/journeys/overview.mjsnow names the real cause.@AuthOwnerOnly/@AuthRawUserof@antelopejs/dms0.21.2 (validateUserToken) reads the session (loadTokenSession) and records the user's activity (recordUserActivity) in MongoDB on every request. With MongoDB stopped, both wait for the driver's 30 s server selection and the request answers 500 before dms-database's route is entered. No source change: nothing in this repo can make an authenticated route answer while the DMS's own database is down.Proof
Journey run on
origin/main(c620351) with its knownFailures entry removed:Same run with
getOverviewHealthreturning at once on a down probe: unchanged, so that code is not on the failing path.Same run with a temporary
console.warn("WDF150 route entered")at the route's entry. The two 500s, logged while MongoDB was stopped, have no entry line before them. The entry lines come from before the stop and after the restart:After this change (entry kept, reason rewritten),
pnpm e2e:run specs/overview.spec.ts -g unreachable --workers=1:Follow-ups
getOverviewHealthstill lists schema summaries and row counts after a failed probe, soGET /api/database/healthwaits for the driver's timeout and the unguardedsampleRowsthrows a 500; done means it answersstatus: downwith the probe's error within the 3 s deadline, proven by a test on a down external connection (needs a fixture this repo lacks today: a stoppable second MongoDB, or a provider on a closed port)