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

stacklok / toolhive / 23639897839

27 Mar 2026 09:31AM UTC coverage: 65.401% (+0.04%) from 65.359%
23639897839

push

github

web-flow
Add tests for horizontal scaling operator behaviors (#4388)

* Inject Redis session storage config into vMCP ConfigMap

Add SessionStorageConfig to pkg/vmcp/config.Config and populate it in
the VirtualMCPServer converter when spec.sessionStorage.provider is
"redis". This allows vMCP pods to discover Redis connection parameters
(address, db, keyPrefix) at startup via the existing config injection
path. The Redis password is excluded from the config type and is
injected separately as the THV_SESSION_REDIS_PASSWORD environment
variable by the deployment builder.

Closes: #4214

* Add tests for horizontal scaling operator behaviors

Unit tests (controllers package):
- TestConfigMapContent_SessionStorage: verifies that ensureVmcpConfigConfigMap
  produces a ConfigMap YAML with the sessionStorage section populated when
  provider=redis, and absent when nil or memory.
- TestDeploymentForVirtualMCPServer_WithRedisPassword: verifies that
  deploymentForVirtualMCPServer injects THV_SESSION_REDIS_PASSWORD as a
  SecretKeyRef env var and never as a plaintext value.

Integration tests (envtest with real CRDs + controller loop):
- MCPServer: ScalingConfig (backend_replicas + session_redis) is written to
  the RunConfig ConfigMap when backendReplicas and Redis sessionStorage are
  set; omitted when absent.
- VirtualMCPServer: spec.replicas is reflected in Deployment.Spec.Replicas;
  nil replicas produces a nil Deployment replicas field for HPA compatibility.

E2E tests (Kind cluster via thv-operator-e2e-test-run):
- VirtualMCPServer created with replicas=2 runs 2 ready pods and sets
  SessionStorageWarning condition when no Redis is configured.
- Scale lifecycle (1→2→1): verifies Deployment replicas update in-place,
  2 pods come up, SessionStorageWarning fires on scale-up and clears on
  scale-down.

Closes: #4220

Fix ignored AddToScheme errors in unit tests

Replace `_ = *.AddToScheme(scheme)` with `require.NoError(t, *.AddToScheme(scheme))`
in virtualmcpserver_d... (continued)

52429 of 80166 relevant lines covered (65.4%)

63.29 hits per line

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

77.84
/pkg/transport/proxy/httpsse/http_proxy.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