fix(tenants): correct tenant get route path#1047
Merged
Merged
Conversation
There was a problem hiding this comment.
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 on lines
+58
to
+61
| _, err := clientset.RESTClient(). | ||
| Get(). | ||
| AbsPath("/apis/capsule.clastix.io/v1beta2/tenants/" + name). | ||
| DoRaw(context.Background()) |
oliverbaehler
approved these changes
Jun 8, 2026
Collaborator
|
@enot237 can you gpg sign and add dco to your commits? |
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>
b50225d to
55f48a5
Compare
Collaborator
|
@enot237 thanks for your contribution |
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.
No description provided.