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 NodeWrapper for testing #3689

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kaisoz
Copy link
Contributor

@kaisoz kaisoz commented Nov 29, 2024

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Creating nodes for testing is quite verbose. This PR introduces the NodeWrapper to make them their creation more compact.

Which issue(s) this PR fixes:

Fixes #3661

Special notes for your reviewer:

This PR only refactors one test so that you can see how the usage NodeWrapper looks like. That's the reason why the NodeWrapper only contains a few methods (the ones I needed for the refactor).

I all is fine, I propose that I can refactor other tests in other PRs 😊

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 29, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kaisoz
Once this PR has been reviewed and has the lgtm label, please assign tenzen-y 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

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 29, 2024
Copy link

netlify bot commented Nov 29, 2024

Deploy Preview for kubernetes-sigs-kueue ready!

Name Link
🔨 Latest commit 3596d74
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/6749aa9a4870700008d0311c
😎 Deploy Preview https://deploy-preview-3689--kubernetes-sigs-kueue.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@mimowo
Copy link
Contributor

mimowo commented Nov 29, 2024

/cc @mbobrovskyi @PBundyra
for the first review passes

@PBundyra
Copy link
Contributor

Looks good! Please use wrapper in the other parts of code as well, including:

  • pkg/scheduler/scheduler_test.go
  • test/integration/controller/jobs/*
  • test/integration/tas/tas_test.go

Copy link
Contributor

@mbobrovskyi mbobrovskyi left a comment

Choose a reason for hiding this comment

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

Overall LGTM

@@ -0,0 +1,69 @@
/*
Copyright 2023 The Kubernetes Authors.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Copyright 2023 The Kubernetes Authors.
Copyright 2024 The Kubernetes Authors.


// StatusConditions updates status conditions of the Node.
func (n *NodeWrapper) StatusConditions(conditions ...corev1.NodeCondition) *NodeWrapper {
n.Status.Conditions = conditions
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe append instead of overriding.

Comment on lines +60 to +63
StatusConditions(corev1.NodeCondition{
Type: corev1.NodeReady,
Status: corev1.ConditionTrue,
}).
Copy link
Contributor

@mimowo mimowo Nov 29, 2024

Choose a reason for hiding this comment

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

I think we could also have a helper Ready() for more brevity. It will append the condition calling StatusConditions (thus the other comment). We can still keep the StatusConditions function for other uses.

@mimowo
Copy link
Contributor

mimowo commented Nov 29, 2024

Looks good! Please use wrapper in the other parts of code as well, including:

I'm also ok to address the other files in a follow up, to de-risk conflicts in the meanwhile, but as you prefer @kaisoz .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TAS: cleanup and introduce node wrapper for testing
5 participants