test(#19): project isolation coverage across unit and integration suites - #36
Open
jpricardo wants to merge 2 commits into
Open
test(#19): project isolation coverage across unit and integration suites#36jpricardo wants to merge 2 commits into
jpricardo wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Closes #19.
Three of the issue's boxes were already ticked by earlier phases — the isolation test, the data-layer cascade test, and the retention-cleanup test all existed. The real gaps were the broker's membership middleware and an end-to-end cascade.
Broker unit tests
X-User-Login/ membership enforcement had no coverage at all. The project handlers dial the Logger themselves viaLOGGER_RPC_ADDR, so there was no seam for a mock:fakelogger_test.goputs a realnet/rpcserver on the other end of that dial instead, which keeps the wire contract intact — including net/rpc flattening errors into strings, which the broker matches on forE11000and "last owner".project_access_test.gothen drives the real router:X-User-Loginrejection across all 17 internal routes403vs. unknown-project404404, andGET /projects/{id}/logsforwarding the path's project409, and the rollback when the owner cannot be attachedBroker suite: 9 → 58 passing assertions.
Integration
project_cascade_test.gobuilds a project the way the dashboard does — create, mint key, set retention, send events — then deletes it and checks all five collections are clear, that the minted key reads nothing back, and that a second delete is a404.TestWritePathRoundTripgained a batch case proving a forgedproject_idin the body is overwritten by the key's project.GetProjectMemberscoverage.Two things found along the way
The suite didn't fit CI's budget. Baseline was 252s against a 300s timeout, because every test built its own containers and stack. The fixtures are now shared (
sharedStack,sharedModelsMongo, teardown viaTestMain): 252s → 71s, with four more tests than before.A latent startup race. The Listener declares and binds the queue at its own pace, and a topic exchange silently drops what it cannot route — so a Broker answering
/pingwas never proof that an accepted event would be stored. This bit during a slow post-recompile startup: events vanished.waitForPipelinenow publishes canaries until one comes back out of MongoDB before any test runs.Also:
logwolf-server/loggerhas unit tests that CI never ran. Added to the workflow; CLAUDE.md and the logger OVERVIEW updated to match.Verification
All four suites green. Mutation-tested rather than trusted green: removing the four owner-only guards fails exactly the 5 expected broker tests, and breaking the api_keys/settings cascade fails both cascade tests with precise messages.
No production source changed — the diff is tests, CI, and docs.
🤖 Generated with Claude Code