Skip to content

tests: simplify test client#1823

Open
AndrewChubatiuk wants to merge 1 commit intomasterfrom
improve-test-client
Open

tests: simplify test client#1823
AndrewChubatiuk wants to merge 1 commit intomasterfrom
improve-test-client

Conversation

@AndrewChubatiuk
Copy link
Contributor

@AndrewChubatiuk AndrewChubatiuk commented Feb 19, 2026

removed custom logic to intercept k8s client requests with built in functionality


Summary by cubic

Simplified the test client by switching from custom request tracking to controller-runtime interceptors, cutting boilerplate and making tests deterministic and clearer.

  • Refactors

    • Removed TestClientWithStatsTrack, call counters, wait loops, and ad-hoc goroutines/tickers in cluster tests.
    • Added GetTestClientWithObjects and GetTestClientWithObjectsAndInterceptors (returns client.Client); unified inputs to []runtime.Object.
    • Updated tests across configmap, deployment, service, statefulset (incl. PVC expand), vlagent, vlcluster, vmagent (incl. scrapeconfig), vmalertmanager, vmanomaly, vmcluster, vmdistributed, vtcluster to assert Create/Get/Update via interceptor events.
    • Switched validate funcs to direct assertions; preserved scheme setup and status subresources.
  • Migration

    • Replace TestClientWithStatsTrack and GetTestClientWithClientObjects with GetTestClientWithObjects.
    • Use GetTestClientWithObjectsAndInterceptors to capture and assert client actions; drop manual status updaters and wait loops.

Written for commit 883e3e5. Summary will update on new commits.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments