[Task] Five critical admin controllers have zero tests
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
## Description
`find shenyu-admin/src/test -name "ControllerTest.java"` confirms no test exists for `NamespaceController`, `AiProxyApiKeyController`, `DiscoveryController`, `DiscoveryUpstreamController`, `ProxySelectorController`. NamespaceController is the multi-tenancy boundary (create/delete namespaces — issues #5945, #6481, #6482 already surfaced bugs here). AiProxyApiKeyController handles AI-proxy api-key material (secrets). DiscoveryController/DiscoveryUpstreamController manage upstream instance config (the surface of bugs #6479, #6517, #6466). ProxySelectorController owns gateway routing config (#6045, #6480). Contrast: AppAuthController, ConfigsExportImportController, PermissionController, DataPermissionController, ResourceController, RoleController, DashboardUserController, SandboxController, ShenyuClientHttpRegistryController all DO have tests.
## Location
```
shenyu-admin/.../controller/NamespaceController.java
AiProxyApiKeyController.java
DiscoveryController.java
DiscoveryUpstreamController.java
ProxySelectorController.java
```
## Impact
RBAC/namespace/secret surfaces regress silently. These are exactly the controllers that produced the recent cluster of open NPE/corruption bugs.
## Suggested fix
Add `@WebMvcTest` controller tests (mirror the existing `AppAuthControllerTest`/`ConfigsExportImportControllerTest` style) for each, with service mocks covering happy + error + permission-denied paths.
## Related existing issue(s)
None
_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by comparing AppAuthControllerTest and ConfigsExportImportControllerTest with the five controllers under shenyu-admin/.../controller. Add @WebMvcTest coverage for NamespaceController, AiProxyApiKeyController, DiscoveryController, DiscoveryUpstreamController, and ProxySelectorController, including happy, error, and permission-denied paths; done means each controller has corresponding tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- authorization, backend, testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100