Skip to content

test(runtime): add UT for jobset runtime valid function. #2562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 15, 2025

Conversation

Harshal292004
Copy link
Contributor

What this PR does / why we need it:
Add fine grained UT for jobset runtime Validate function.

Which issue(s) this PR fixes
Fixes #2556

Checklist:

  • Docs included if any changes are user facing

@Harshal292004
Copy link
Contributor Author

@tenzen-y Could you please look into this PR fixing #2556 Jobset UTs

@IRONICBo
Copy link
Contributor

IRONICBo commented Mar 25, 2025

/ok-to-test
/rerun-all

Copy link
Contributor

@IRONICBo IRONICBo left a comment

Choose a reason for hiding this comment

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

Other LGTM, Thanks for your contribution.

cc @tenzen-y

if err != nil {
t.Fatalf("Failed to initialize JobSet plugin: %v", err)
}
warnings, errs := p.(framework.CustomValidationPlugin).Validate(tc.runtimeJobTemplate, nil, tc.oldObj, tc.newObj)
Copy link
Contributor

Choose a reason for hiding this comment

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

Upstream has update the Validate functions, you can rebase your commit to main and remove fist params here.

},
},
"model intializer job exists but container missing ": {
runtimeJobTemplate: func() client.Object {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto, you can remove it because we don't need runtimeJobTemplate now.

},
// assert that we get a error here
"dataset initializer job exists but container missing": {
runtimeJobTemplate: func() client.Object {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto, you can remove it.

},
},
"no model intializer job": {
runtimeJobTemplate: utiltesting.MakeJobSetWrapper(metav1.NamespaceDefault, "test"),
Copy link
Contributor

@IRONICBo IRONICBo Mar 25, 2025

Choose a reason for hiding this comment

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

Ditto, you can remove it.

Obj(),
},
"no dataset intializer job": {
runtimeJobTemplate: utiltesting.MakeJobSetWrapper(metav1.NamespaceDefault, "test"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto, you can remove it.

Obj(),
},
"no initializer job": {
runtimeJobTemplate: utiltesting.MakeJobSetWrapper(metav1.NamespaceDefault, "test"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto, you can remove it.

wantWarnings admission.Warnings
}{
"no jobset runtime template": {
runtimeJobTemplate: &utiltesting.JobSetWrapper{},
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto, you can remove it.

@Harshal292004
Copy link
Contributor Author

@IRONICBo I updated the entire test . Can you have a look

@Harshal292004
Copy link
Contributor Author

@tenzen-y I have removed the test case where runtimeInfo is nil it's causing panic when accessing ReplicatedJobs from jobSetSpec. Other test cases are passing successfully

@Harshal292004
Copy link
Contributor Author

@IRONICBo
Copy link
Contributor

/rerun-all

@coveralls
Copy link

coveralls commented Mar 26, 2025

Pull Request Test Coverage Report for Build 14470201388

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.9%) to 67.356%

Totals Coverage Status
Change from base Build 14412786058: 0.9%
Covered Lines: 1758
Relevant Lines: 2610

💛 - Coveralls

@Harshal292004
Copy link
Contributor Author

/rerun-all

@Harshal292004
Copy link
Contributor Author

@IRONICBo Can you please rerun the workflows there was a gci error in the last run

@IRONICBo
Copy link
Contributor

/rerun-all

@IRONICBo
Copy link
Contributor

@IRONICBo Can you please rerun the workflows there was a gci error in the last run

OK

@IRONICBo
Copy link
Contributor

Thank you!
/lgtm

@Harshal292004
Copy link
Contributor Author

Hi @IRONICBo ,

I recently raised two PRs for Kubeflow Trainer, both of which passed all checks. One of them was reviewed by @tenzen-y , but it hasn’t been merged yet as no approvals or suggestions were provided by the reviewers.

Could you clarify if there’s a specific process for PRs to get merged? Should I wait for approval, or is there something I should do to get more reviewer attention?

@IRONICBo
Copy link
Contributor

IRONICBo commented Mar 27, 2025

Hi @IRONICBo ,

I recently raised two PRs for Kubeflow Trainer, both of which passed all checks. One of them was reviewed by @tenzen-y , but it hasn’t been merged yet as no approvals or suggestions were provided by the reviewers.

Could you clarify if there’s a specific process for PRs to get merged? Should I wait for approval, or is there something I should do to get more reviewer attention?

I am not sure, and you may need to wait for other reviewers to process it, other reviews may be busy with other threads.

@Harshal292004
Copy link
Contributor Author

@tenzen-y Could you please review this PR ?

Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

Thank you
Basically, lgtm

I added a few nit comments.

@@ -325,3 +329,211 @@ func TestJobSet(t *testing.T) {
})
}
}

func TestJobSetValidate(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func TestJobSetValidate(t *testing.T) {
func TestValidate(t *testing.T) {

In Go, we use Test prefix as a Test function name.

func TestJobSetValidate(t *testing.T) {
cases := map[string]struct {
info *runtime.Info
_ *trainer.TrainJob
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_ *trainer.TrainJob

This is unused field.

if err != nil {
t.Fatalf("Failed to initialize JobSet plugin: %v", err)
}

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

Initializer(&trainer.Initializer{Dataset: nil}).
Obj(),
},
"must have dataset initializer job when trainJob is configured with input datasetConfig": {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"must have dataset initializer job when trainJob is configured with input datasetConfig": {
"must have dataset initializer job when trainJob is configured with input datasetConfig": {

Signed-off-by: Harshal292004 <malaniharshal95@gmail.com>
Signed-off-by: Harshal292004 <malaniharshal95@gmail.com>
Signed-off-by: Harshal292004 <malaniharshal95@gmail.com>
Signed-off-by: Harshal292004 <malaniharshal95@gmail.com>
Signed-off-by: Harshal292004 <malaniharshal95@gmail.com>
@Harshal292004
Copy link
Contributor Author

@tenzen-y Updated everything as suggested

@Harshal292004
Copy link
Contributor Author

@tenzen-y, I was wondering if there are any significant opportunities for contribution within Kubeflow at the moment? @Electronic-Waste is currently focused on KEP 2401, so there isn’t much for me to do in that area.

@tenzen-y
Copy link
Member

@tenzen-y, I was wondering if there are any significant opportunities for contribution within Kubeflow at the moment? @Electronic-Waste is currently focused on KEP 2401, so there isn’t much for me to do in that area.

Every contribution is valuable. If you have an interest in any feature development, please contact the issue creator.

Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

Thank you
/lgtm
/approve

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tenzen-y

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

The pull request process is described 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

@google-oss-prow google-oss-prow bot merged commit b9c0ee2 into kubeflow:master Apr 15, 2025
18 checks passed
@google-oss-prow google-oss-prow bot added this to the v2.0 milestone Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement UTs for Plugin CustomValidations
4 participants