Skip to content

fix(tenants): correct tenant get route path#1047

Merged
oliverbaehler merged 1 commit into
projectcapsule:mainfrom
enot237:fix/tenant-get-route
Jun 9, 2026
Merged

fix(tenants): correct tenant get route path#1047
oliverbaehler merged 1 commit into
projectcapsule:mainfrom
enot237:fix/tenant-get-route

Conversation

@enot237

@enot237 enot237 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings June 5, 2026 10:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR fixes the Tenant GET module route path and adds automated coverage to ensure the route matches correctly and enforces RBAC expectations for tenant owners vs non-owners.

Changes:

  • Fix tenant GET path to use the actual Capsule API group and tenants resource segment.
  • Add a router-level unit test to validate mux path matching and {name} extraction.
  • Add an e2e test asserting owners can GET their tenant by name and non-owners are denied.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
internal/modules/tenants/get.go Fixes the GET endpoint path from an invalid placeholder to a concrete Capsule group/resource path.
internal/modules/tenants/get_test.go Adds a unit test that asserts the route matches and extracts the tenant name variable.
e2e/tenant_test.go Adds e2e coverage for tenant GET-by-name authorization behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


func (g get) Path() string {
return "/apis/{}/v1beta2/tenants/{name}"
return "/apis/" + types.CapsuleGroup + "/v1beta2/" + types.Tenants + "/{name}"
Comment thread e2e/tenant_test.go
Comment on lines +58 to +61
_, err := clientset.RESTClient().
Get().
AbsPath("/apis/capsule.clastix.io/v1beta2/tenants/" + name).
DoRaw(context.Background())
@oliverbaehler

Copy link
Copy Markdown
Collaborator

@enot237 can you gpg sign and add dco to your commits? git commit -S -s ..

The tenant get route was using a hardcoded placeholder string instead of the actual API group and resource types. This prevented the router from correctly matching requests for specific tenants.

This change updates the path to use `types.CapsuleGroup` and `types.Tenants` to ensure the route is correctly constructed. Added unit tests for the path matching and e2e tests to verify tenant access control via the API.

Signed-off-by: Anisimov Evgeniy <anisimov.evgeniy.s@gmail.com>
@enot237 enot237 force-pushed the fix/tenant-get-route branch from b50225d to 55f48a5 Compare June 9, 2026 08:27
@oliverbaehler oliverbaehler merged commit a2fef14 into projectcapsule:main Jun 9, 2026
14 checks passed
@oliverbaehler

Copy link
Copy Markdown
Collaborator

@enot237 thanks for your contribution

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.

3 participants