Skip to content

Extract shared E2E helpers into testutil package#4654

Open
jerm-dro wants to merge 1 commit intojerm-dro/rate-limit-middlewarefrom
jerm-dro/e2e-testutil
Open

Extract shared E2E helpers into testutil package#4654
jerm-dro wants to merge 1 commit intojerm-dro/rate-limit-middlewarefrom
jerm-dro/e2e-testutil

Conversation

@jerm-dro
Copy link
Copy Markdown
Contributor

@jerm-dro jerm-dro commented Apr 7, 2026

Summary

The acceptance_tests and virtualmcp E2E test packages duplicated
generic Kubernetes helpers (pod readiness checks, log retrieval,
MCPServer wait, NodePort management). This extracts them into a
shared test/e2e/thv-operator/testutil/ package.

Stacked on #4652.

Type of change

  • Refactoring (no behavior change)

Test plan

  • Unit tests (task test)
  • Linting (task lint-fix)

No behavior change — existing tests compile and pass with the
delegated helpers.

Changes

File Change
test/e2e/thv-operator/testutil/k8s.go New: shared CheckPodsReady, GetPodLogs, WaitForMCPServerRunning, CreateNodePortService, GetNodePort
test/e2e/thv-operator/virtualmcp/helpers.go Delegate checkPodsReady and getPodLogs to testutil
test/e2e/thv-operator/acceptance_tests/ Import WaitForMCPServerRunning, CreateNodePortService, GetNodePort from testutil

Generated with Claude Code

Move generic Kubernetes test helpers from virtualmcp/helpers.go into
a shared test/e2e/thv-operator/testutil/ package so both virtualmcp
and acceptance_tests can reuse them without duplication.

Extracted helpers:
- CheckPodsReady: checks pod readiness by labels
- GetPodLogs: retrieves container logs via clientset
- WaitForMCPServerRunning: polls MCPServer phase
- CreateNodePortService / GetNodePort: NodePort access

The virtualmcp package delegates its private checkPodsReady and
getPodLogs to testutil, keeping its public API stable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the size/M Medium PR: 300-599 lines changed label Apr 7, 2026
@jerm-dro jerm-dro marked this pull request as ready for review April 7, 2026 23:40
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.93%. Comparing base (0f476a5) to head (28d510d).

Additional details and impacted files
@@                        Coverage Diff                         @@
##           jerm-dro/rate-limit-middleware    #4654      +/-   ##
==================================================================
+ Coverage                           68.84%   68.93%   +0.09%     
==================================================================
  Files                                 509      509              
  Lines                               52642    52614      -28     
==================================================================
+ Hits                                36240    36270      +30     
+ Misses                              13607    13548      -59     
- Partials                             2795     2796       +1     

☔ 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.

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.

1 participant