Repository navigation
Closed as not planned
Labels
enhancementNew feature or requestgoPull requests that update go codekubernetesItems related to KubernetesoperatorvmcpVirtual MCP Server related issues
Description
Summary
Reorganize vMCP tests into distinct e2e and integration test layers for faster feedback loops and better edge case coverage.
Background
Current vMCP test architecture:
- ~5,500 lines of e2e tests in
test/e2e/thv-operator/virtualmcp/ - Tests cover: auth discovery, aggregation, filtering, overrides, conflict resolution, composite workflows
- All tests run against a real Kubernetes cluster
- E2E tests are slow due to full cluster setup/teardown
Current Test Files
test/e2e/thv-operator/virtualmcp/
├── suite_test.go (101 lines)
├── helpers.go (631 lines)
├── virtualmcp_auth_discovery_test.go (1,591 lines)
├── virtualmcp_aggregation_filtering_test.go (322 lines)
├── virtualmcp_aggregation_overrides_test.go (295 lines)
├── virtualmcp_conflict_resolution_test.go (686 lines)
├── virtualmcp_composite_parallel_test.go (374 lines)
├── virtualmcp_composite_sequential_test.go (317 lines)
├── virtualmcp_discovered_mode_test.go (391 lines)
├── virtualmcp_inline_auth_test.go (467 lines)
└── virtualmcp_yardstick_base_test.go (337 lines)
Problem
- Slow CI feedback - Full e2e tests take significant time
- Edge case difficulty - Hard to test timeouts, network failures, partial failures in e2e
- No test layer separation - All tests require full Kubernetes environment
Proposed Structure
Integration Tests (test/integration/vmcp/)
Fast tests that don't require Kubernetes:
- Aggregator logic (conflict resolution, capability merging)
- Router logic (tool routing, backend selection)
- Composer logic (workflow execution, template expansion)
- Config loading and validation
- Mock backend interactions
E2E Tests (test/e2e/thv-operator/virtualmcp/)
Full cluster tests for end-to-end validation:
- CRD creation and reconciliation
- Full request flow (client → vMCP → backend)
- Auth flows (OIDC, token exchange)
- Status reporting
Implementation
-
Create integration test structure
test/integration/vmcp/ ├── aggregator_test.go # Conflict resolution, capability merging ├── router_test.go # Request routing logic ├── composer_test.go # Workflow execution ├── config_test.go # Configuration validation └── helpers.go # Mock backends, test utilities -
Extract testable logic
- Ensure vMCP packages are unit-testable
- Add interfaces for backend interactions (already exists)
- Create mock implementations for testing
-
Move edge case tests to integration
- Timeout handling
- Partial backend failures
- Invalid configurations
- Concurrent request handling
-
Update CI pipeline
- Run integration tests on every PR
- Run e2e tests on merge to main (or nightly)
Acceptance Criteria
- Integration test directory created
- Core logic tests extracted from e2e
- Integration tests run without Kubernetes
- Edge case tests (timeouts, failures) in integration layer
- E2E tests remain for full flow validation
- CI pipeline updated for two-tier testing
- Test documentation updated
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestgoPull requests that update go codekubernetesItems related to KubernetesoperatorvmcpVirtual MCP Server related issues
Activity
jerm-dro commentedon Dec 12, 2025
I'm concerned that if we rewrite k8s tests into simpler integration tests then we'll lose coverage of the operator and config plumbing. This lack of coverage could result in functionality that is working in integration tests but fails when using the k8s operator.
Background: Currently, config for operators goes through many transformation:
CRD config -> yaml -> rawConfig -> actual config.I've first-hand experienced this where I have passing integration tests and the problem is something broken/missing in this series of transformations.
I'd suggest we don't do this work until
P(Feature X works in operator | Feature X works in integration tests)is nearly 1. In other words, I think we need to simplify the configuration system before reducing our test coverage on the operator.jhrozek commentedon Dec 15, 2025
I'm not against that, the argument was that integration tests are faster to run and can test corner cases, too, where many of our e2e tests were just testing the conversion to the right config anyway.
If you want to take the issue, reword it and propose how you feel the testing should be done, it would be very much appreciated.
(Don't feel bound by the issue title, the point really is to "make sure we have appropriate test coverage")
jerm-dro commentedon Dec 19, 2025
@jhrozek I think this issue has merit as is, but should be proceeded by other work. I was once again bitten by a config plumbing issue: https://github.com/stacklok/toolhive/compare/jerm/2025-12-18-fix-config-plumbing?expand=1. I haven't had the time to write a regression test for this, but we already have an integration test that passes.
I'll draft an issue tomorrow describing the config problem and potential solution in greater detail..
jerm-dro commentedon Jan 7, 2026
I'll be picking this up once #3125 is completed
jerm-dro commentedon Feb 3, 2026
The vMCP folks and I discussed this a bit today and decided to deprioritize this issue. Re-writing tests will be a non-negligible lift. Within the vMCP work, we have been working towards writing more unit tests and only relying on integration tests as smoke tests. Furthermore, the current factoring of the vMCP system means a lot of these e2e tests provide meaningful coverage that can't be verified at lower levels (e.g. config plumbing, reconciler behavior).
For the time being, I've removed this from Stacklok's productionization epic. We can revisit this again in the future.