• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 18564002743

16 Oct 2025 02:04PM UTC coverage: 46.716% (-0.05%) from 46.766%
18564002743

push

github

web-flow
Extract common controller helpers from MCPRemoteProxy PR (#2230)

* Extract common controller helpers and refactor MCPServer to use SharedPlatformDetector

This extracts common helper functions from the large MCPRemoteProxy PR
(#2226) into a shared common_helpers.go file that can be used by multiple
controllers.

Changes:
- Add common_helpers.go with shared helper functions:
  - SharedPlatformDetector for platform detection across controllers
  - RBAC resource creation helpers (EnsureRBACResource, createRBACResource)
  - OpenTelemetry environment variable generation
  - Token exchange environment variable generation
  - Authorization volume configuration (GenerateAuthzVolumeConfig)
  - Authorization ConfigMap management (EnsureAuthzConfigMap)
  - Authorization config options for RunConfig (AddAuthzConfigOptions)
  - GetExternalAuthConfigByName for fetching external auth configs

- Refactor MCPServerReconciler to use SharedPlatformDetector:
  - Replace individual platformDetector, detectedPlatform, and platformOnce
    fields with single PlatformDetector field
  - Update detectPlatform() to use shared detector
  - Initialize SharedPlatformDetector in main.go
  - Update deploymentForMCPServer to use local detectedPlatform variable

- Add test helpers and fixtures:
  - newTestMCPServerReconciler() for test setup
  - newTestMCPServerReconcilerWithDetector() for custom detector injection
  - NewSharedPlatformDetectorWithDetector() for testing with mock detectors
  - Update all test files to use new helper functions
  - Fix imports in all test files to include kubernetes package

This is the first step in adopting the common helpers from PR #2226.
Additional refactoring will follow to adopt the remaining helper functions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* Refactor MCPServer controller to use common helper functions

This completes the adoption of common helper functions from PR #2226,
removing duplication between the MCPServ... (continued)

233 of 329 new or added lines in 4 files covered. (70.82%)

23 existing lines in 2 files now uncovered.

17912 of 38342 relevant lines covered (46.72%)

15.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.05
/cmd/thv-operator/controllers/mcpserver_controller.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc