Skip to content

Conversation

@vrd-cse
Copy link

@vrd-cse vrd-cse commented Oct 29, 2025

This adds comprehensive unit tests for the OptimizerClient methods in KubernetesBackend, mirroring the existing test structure used for TrainerClient in backend_test.py.

Tests cover:

  • get_runtime (success, timeout, runtime error)
  • list_runtimes
  • optimize (study creation)
  • get_study
  • list_studies
  • get_study_logs
  • delete_study

All tests use pytest fixtures, mock Kubernetes API calls closes #126

What this PR does / why we need it:
Adds unit tests for OptimizerClient in the Kubernetes backend, exactly matching the style and structure of the existing TrainerClient tests in backend_test.py.

Which issue(s) this PR fixes (optional, in Fixes #<issue number>, #<issue number>, ... format, will close the issue(s) when PR gets merged):
it closes #126

Fixes #126

Checklist:
-[x] Tests added ('tests_OptimizerClient.py`)

  • Follows existing test pattern (fixtures, mocks, TestCase)
  • All tests pass locally:
    python -m pytest -v kubeflow/trainer/backends/kubernetes/tests_OptimizerClient.py
    
  • Docs included if any changes are user facing

This adds comprehensive unit tests for the OptimizerClient methods in
KubernetesBackend, mirroring the existing test structure used for
TrainerClient in backend_test.py.

Tests cover:
- get_runtime (success, timeout, runtime error)
- list_runtimes
- optimize (study creation)
- get_study
- list_studies
- get_study_logs
- delete_study

All tests use pytest fixtures, mock Kubernetes API calls
closes kubeflow#124
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign andreyvelich for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create unit tests for the OptimizerClient()

2 participants