Skip to content

test(integration): verify RPC project isolation end-to-end - #25

Merged
jpricardo merged 3 commits into
feat/multi-tenancyfrom
feat/rpc-project-scope
Apr 18, 2026
Merged

test(integration): verify RPC project isolation end-to-end#25
jpricardo merged 3 commits into
feat/multi-tenancyfrom
feat/rpc-project-scope

Conversation

@jpricardo

Copy link
Copy Markdown
Owner

Summary

  • Adds TestProjectIsolation_GetLogs: posts one log per project through the full broker→RabbitMQ→listener→logger stack, then queries each project's logs via GET /logs and asserts cross-project visibility is impossible.
  • Adds TestProjectIsolation_DeleteLog: posts one log per project, deletes project A's log via DELETE /logs, and asserts project B's log is unaffected.
  • Adds shared test helpers (seedAPIKey, postLog, waitForLog, getLogs, fetchLogID, deleteLog, containsName) that reuse the existing startStack infrastructure.

Closes #8

Test plan

  • cd logwolf-server/integration && go test -tags integration ./... -v -timeout 5m — both new tests should pass alongside existing ones
  • Existing broker and toolbox unit tests remain green

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Apr 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
logwolf-docs Ready Ready Preview, Comment Apr 18, 2026 9:19pm

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>
@jpricardo
jpricardo merged commit 7cd94b5 into feat/multi-tenancy Apr 18, 2026
5 checks passed
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