test(integration): verify RPC project isolation end-to-end - #25
Merged
Conversation
Add two integration tests that exercise the project-scoped RPC methods through the full broker→RabbitMQ→listener→logger stack: - TestProjectIsolation_GetLogs: logs written for project A must not appear when querying as project B, and vice versa. - TestProjectIsolation_DeleteLog: deleting a log as project A must not affect logs owned by project B. Closes #8 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Replace every hard-coded "logger:5001" in the broker with a loggerRPCAddr() helper that falls back to "logger:5001" when the env var is absent. The listener already did this; now the broker is consistent. This was causing the two new project-isolation integration tests to fail because the integration test harness passes LOGGER_RPC_ADDR with a dynamic port, but the broker was ignoring it and trying to resolve the Docker service name "logger" in the CI environment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
TestProjectIsolation_CrossDelete verifies that project A cannot delete a log owned by project B, even when supplying the correct log ID. The broker scopes the DELETE filter to the authenticated project, so the DB query (id=B AND project_id=A) matches nothing and returns 0 deleted. Also adds deleteLogCount helper to parse the deleted count from the broker response body. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
TestProjectIsolation_GetLogs: posts one log per project through the full broker→RabbitMQ→listener→logger stack, then queries each project's logs viaGET /logsand asserts cross-project visibility is impossible.TestProjectIsolation_DeleteLog: posts one log per project, deletes project A's log viaDELETE /logs, and asserts project B's log is unaffected.seedAPIKey,postLog,waitForLog,getLogs,fetchLogID,deleteLog,containsName) that reuse the existingstartStackinfrastructure.Closes #8
Test plan
cd logwolf-server/integration && go test -tags integration ./... -v -timeout 5m— both new tests should pass alongside existing ones🤖 Generated with Claude Code