Skip to content

chore(test): add unit tests for trainingruntime and trainjob utilities#3370

Open
codewithyug06 wants to merge 1 commit intokubeflow:masterfrom
codewithyug06:test/add-unit-tests-trainingruntime-util
Open

chore(test): add unit tests for trainingruntime and trainjob utilities#3370
codewithyug06 wants to merge 1 commit intokubeflow:masterfrom
codewithyug06:test/add-unit-tests-trainingruntime-util

Conversation

@codewithyug06
Copy link
Copy Markdown

Fixes #3152

What this PR does

Adds missing unit test coverage for two utility packages as part of #3152.

Changes

pkg/util/trainingruntime/trainingruntime_test.go (NEW FILE)

  • TestIsSupportDeprecated: 8 test cases covering nil labels, empty labels,
    absent key, wrong value, empty value, correct deprecated value, multiple
    labels with deprecated, and partial string match edge case.
  • This package previously had 0% test coverage.

pkg/util/trainjob/trainjob_test.go (EXTENDED)

  • TestRuntimeRefIsClusterTrainingRuntime: 4 new edge cases covering wrong
    APIGroup, nil APIGroup, nil Kind, and both nil.
  • TestIsTrainJobFinished: 6 new cases covering Complete=True, Failed=True,
    no conditions, Complete=False, Failed=False, and both true.
  • Added metav1 import required for Condition status constants.

Testing

go test ./pkg/util/trainingruntime/... -v → PASS (8/8 subtests)
go test ./pkg/util/trainjob/... -v → PASS (14/14 subtests)

Checklist

  • Tests pass locally
  • DCO signed-off in commit message
  • No breaking changes to existing tests
  • Follows existing test pattern (map-based cases, no shared state)

Copilot AI review requested due to automatic review settings March 20, 2026 19:22
@google-oss-prow
Copy link
Copy Markdown

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

Details 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

@github-actions
Copy link
Copy Markdown

🎉 Welcome to the Kubeflow Trainer! 🎉

Thanks for opening your first PR! We're happy to have you as part of our community 🚀

Here's what happens next:

  • If you haven't already, please check out our Contributing Guide for repo-specific guidelines and the Kubeflow Contributor Guide for general community standards.
  • Our team will review your PR soon! cc @kubeflow/kubeflow-trainer-team

Join the community:

Feel free to ask questions in the comments if you need any help or clarification!
Thanks again for contributing to Kubeflow! 🙏

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Fixes kubeflow#3152

pkg/util/trainingruntime (0 percent to 100 percent coverage):
- New trainingruntime_test.go with 8 cases for IsSupportDeprecated
  covering nil, empty, absent key, wrong value, empty value,
  correct deprecated, multiple labels, and partial match edge case.

pkg/util/trainjob (extended):
- TestRuntimeRefIsClusterTrainingRuntime: 4 new edge cases added
  covering wrong APIGroup, nil APIGroup, nil Kind, both nil.
- TestIsTrainJobFinished: 6 new cases covering all condition states.
- Added metav1 import required for Condition status constants.

Signed-off-by: Yugendhar S <yugendhars06@gmail.com>
@codewithyug06 codewithyug06 force-pushed the test/add-unit-tests-trainingruntime-util branch from cca929a to 8dd6324 Compare March 20, 2026 19:26
@codewithyug06 codewithyug06 changed the title test(util): add unit tests for trainingruntime and trainjob utilities chore(util): add unit tests for trainingruntime and trainjob utilities Mar 20, 2026
@codewithyug06 codewithyug06 changed the title chore(util): add unit tests for trainingruntime and trainjob utilities chore(test): add unit tests for trainingruntime and trainjob utilities Mar 20, 2026
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.

[Feature]: Add unit tests for core and framework to cover reasonable coverage

2 participants