Skip to content

test(config): add integration test for WithGuard option#393

Open
zeevdr wants to merge 1 commit into
mainfrom
issue-304-withguard-integration-test
Open

test(config): add integration test for WithGuard option#393
zeevdr wants to merge 1 commit into
mainfrom
issue-304-withguard-integration-test

Conversation

@zeevdr
Copy link
Copy Markdown
Member

@zeevdr zeevdr commented May 14, 2026

Summary

  • WithGuard had no test — the option could be silently ignored (e.g., a wiring mistake in NewService) without any test catching it.
  • Two cases cover the full contract: a rejecting guard causes the first auth-gated RPC call to return PermissionDenied, and a permissive guard lets the same call succeed end-to-end.
  • A local stubGuard type implements the authz.Guard interface with a fixed return value, keeping the test self-contained without new production code.

Test plan

  • TestNewService_WithGuard_ReplacesDefaultGuard — custom guard returning PermissionDenied is honoured; call fails with that code.
  • TestNewService_WithGuard_AllowAll — custom guard returning nil allows GetConfig to complete successfully.
  • Both tests pass under go test ./internal/config/....
  • make lint passes.

Closes #304

🤖 Generated with Claude Code

WithGuard had no test — the option could be silently ignored without
any test catching it. Two cases cover the full contract: a rejecting
guard causes the first auth-gated call to fail with PermissionDenied,
and a permissive guard lets the same call succeed.

Co-Authored-By: Claude <noreply@anthropic.com>
Closes #304
@zeevdr zeevdr added this to the v0.11.0-alpha.2 milestone May 14, 2026
@zeevdr zeevdr added enhancement New feature or request server Server changes size: S Quick win — a few hours or less priority: P2 Nice-to-have labels May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: P2 Nice-to-have server Server changes size: S Quick win — a few hours or less

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integration test for WithGuard option in ConfigService

1 participant