Skip to content
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

add unit test for dra/manager.go #118711

Merged
merged 1 commit into from Jul 18, 2023

Conversation

TommyStarK
Copy link
Contributor

@TommyStarK TommyStarK commented Jun 16, 2023

co-author: @charles-chenzz
co-author: @TommyStarK

What type of PR is this?

/kind feature

What this PR does / why we need it:

Add unit test to the DRA manager

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Follow up for #118436

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jun 16, 2023
@TommyStarK
Copy link
Contributor Author

/cc @bart0sh @charles-chenzz
/assign @klueska

@bart0sh
Copy link
Contributor

bart0sh commented Jun 16, 2023

/triage accepted
/priority important-longterm
/assign

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jun 16, 2023
@bart0sh bart0sh moved this from Triage to Needs Reviewer in SIG Node PR Triage Jun 16, 2023
@TommyStarK
Copy link
Contributor Author

/cc @pohly

@k8s-ci-robot k8s-ci-robot requested a review from pohly July 2, 2023 12:16
@pohly
Copy link
Contributor

pohly commented Jul 3, 2023

This is likely to conflict with #119012. I'd prefer to merge that first because it has to be before code freeze, while this test can still be merged before test freeze.

@TommyStarK
Copy link
Contributor Author

Sure @pohly, I will solve the conflicts once your pr is merged. You might want to take a look at #118619 this is likely to conflict with yours. I found also this one (#118761 ) into the DRA board. The latter shouldn't conflict.

@TommyStarK
Copy link
Contributor Author

@klueska @bart0sh Rebased and fixed conflicts after Patrick's PR got merged.

@bart0sh
Copy link
Contributor

bart0sh commented Jul 13, 2023

Overall approach looks good to me. A couple of suggestions:

  • combining all test cases that test one API (e.g. NodePrepareResources) into one would make the test clearer and eliminate code duplication. I'd suggest to at least combine TestPrepareUnprepareResources, TestPrepareResourcesWithTimeout, TestPrepareResoucesErrorCases into one test case.
  • Please, test at least important error conditions. A lot of them are not covered.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 15, 2023
@TommyStarK
Copy link
Contributor Author

@bart0sh, I updated the PR to combine all test cases that test one API. I tried to cover as much as error cases as possible.
This is what I ended with:
Screenshot 2023-07-15 at 16 38 07
Screenshot 2023-07-15 at 16 38 20

If you do not mind, I'd suggest to to address the review asap to get this merged before the code freeze. I will continue working to increase the code coverage and cover the important error conditions.
/cc @klueska

@TommyStarK
Copy link
Contributor Author

/test pull-kubernetes-node-e2e-crio-dra

Copy link
Contributor

@bart0sh bart0sh 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 for the PR. Overall looks very good.

pkg/kubelet/cm/dra/manager_test.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/dra/manager_test.go Show resolved Hide resolved
pkg/kubelet/cm/dra/manager_test.go Outdated Show resolved Hide resolved
pkg/kubelet/cm/dra/manager_test.go Outdated Show resolved Hide resolved
Co-Authored-By: charles-chenzz <Rekles666@gmail.com>
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
@klueska
Copy link
Contributor

klueska commented Jul 18, 2023

I only did a quick pass, but in general any unit tests are better than none.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 18, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: a3ff003a7e9c481c2bfd119711f0b097e3656f96

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: klueska, TommyStarK

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 18, 2023
@k8s-ci-robot k8s-ci-robot merged commit 6d83e22 into kubernetes:master Jul 18, 2023
14 checks passed
SIG Node PR Triage automation moved this from Needs Reviewer to Done Jul 18, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.28 milestone Jul 18, 2023
@TommyStarK TommyStarK deleted the tom/gh_118436 branch July 18, 2023 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants