Skip to content

Add optimizer+circuit breaker acceptance test for vMCP#4052

Merged
aponcedeleonch merged 1 commit intomainfrom
aponce/optimizer-circuit-breaker-acceptance-test
Mar 9, 2026
Merged

Add optimizer+circuit breaker acceptance test for vMCP#4052
aponcedeleonch merged 1 commit intomainfrom
aponce/optimizer-circuit-breaker-acceptance-test

Conversation

@aponcedeleonch
Copy link
Copy Markdown
Member

Summary

  • Issue Acceptance testing — circuit breaker excludes unhealthy backends from the optimizer #3760 requires acceptance tests validating that unhealthy backends are excluded from the optimizer's find_tool results when the circuit breaker opens, and re-included after recovery.
  • Adds a new E2E test suite (VirtualMCPServer Optimizer with Circuit Breaker) that exercises the filterHealthyBackends() integration path end-to-end through the optimizer, using two backends (yardstick for echo, gofetch for fetch), an EmbeddingServer, and a VirtualMCPServer with both optimizer and circuit breaker enabled.

Closes #3760

Type of change

  • New feature

Test plan

  • Linting (task lint-fix)
  • Manual testing (describe below)

Verified the test compiles (go build ./test/e2e/thv-operator/virtualmcp/...), passes go vet, linting (task lint-fix), and SPDX license checks (task license-check). Full E2E execution requires a Kind cluster with the operator deployed (CI).

Changes

File Change
test/e2e/thv-operator/virtualmcp/virtualmcp_optimizer_circuit_breaker_test.go New acceptance test: 4 ordered test cases covering healthy discovery, circuit breaker exclusion, recovery restoration, and stable backend independence

Does this introduce a user-facing change?

No

Special notes for reviewers

  • Reuses existing patterns: circuit breaker lifecycle (image swap → ImagePullBackOff → recovery) from virtualmcp_circuit_breaker_test.go, optimizer helpers (callFindTool/getToolNames) from virtualmcp_optimizer_test.go, and shared CB constants.
  • The key assertion in test case 2 verifies that after the circuit breaker opens and a new MCP session is created, find_tool no longer returns tools prefixed with the unhealthy backend name — validating the filterHealthyBackends() middleware filters backends before the optimizer indexes them.
  • Test case 3 validates the reverse: after recovery and circuit breaker closure, a new session sees all tools again.

Generated with Claude Code

@github-actions github-actions bot added the size/M Medium PR: 300-599 lines changed label Mar 9, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.70%. Comparing base (f7cc727) to head (9999006).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4052      +/-   ##
==========================================
+ Coverage   68.63%   68.70%   +0.07%     
==========================================
  Files         446      446              
  Lines       45424    45424              
==========================================
+ Hits        31175    31207      +32     
+ Misses      11840    11808      -32     
  Partials     2409     2409              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aponcedeleonch aponcedeleonch force-pushed the aponce/optimizer-circuit-breaker-acceptance-test branch from ad89819 to a4c3b7d Compare March 9, 2026 16:39
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 9, 2026
Validates that unhealthy backends are excluded from the optimizer's
find_tool results when the circuit breaker opens, and re-included
after recovery. Tests the filterHealthyBackends() integration path
end-to-end through the optimizer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aponcedeleonch aponcedeleonch force-pushed the aponce/optimizer-circuit-breaker-acceptance-test branch from a4c3b7d to 9999006 Compare March 9, 2026 19:09
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 9, 2026
@aponcedeleonch aponcedeleonch merged commit fcb1241 into main Mar 9, 2026
36 checks passed
@aponcedeleonch aponcedeleonch deleted the aponce/optimizer-circuit-breaker-acceptance-test branch March 9, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR: 300-599 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Acceptance testing — circuit breaker excludes unhealthy backends from the optimizer

2 participants