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

test/e2e/framework/node/:remove TODO and and make some functions private #88374

Merged
merged 1 commit into from Feb 22, 2020
Merged

test/e2e/framework/node/:remove TODO and and make some functions private #88374

merged 1 commit into from Feb 22, 2020

Conversation

tanjunchen
Copy link
Member

@tanjunchen tanjunchen commented Feb 20, 2020

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Which issue(s) this PR fixes:

ref:#86763

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

None

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

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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 20, 2020
@tanjunchen tanjunchen changed the title test/e2e/framework/node/:refactor isNodeConditionSetAsExpected test/e2e/framework/node/:refactor function isNodeConditionSetAsExpected and and make some functions private Feb 20, 2020
@k8s-ci-robot k8s-ci-robot added area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 20, 2020
@@ -67,51 +67,40 @@ func FirstAddress(nodelist *v1.NodeList, addrType v1.NodeAddressType) string {
return ""
}

// TODO: better to change to a easy read name
Copy link
Member Author

Choose a reason for hiding this comment

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

i think this name is ok,so i want to remove this TODO

// TODO: need to discuss wether to return bool and error type
func IsNodeUntainted(node *v1.Node) bool {
Copy link
Member Author

Choose a reason for hiding this comment

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

this function is used only test/e2e/framework/node , so make it private.

@@ -138,8 +126,8 @@ func IsConditionSetAsExpectedSilent(node *v1.Node, conditionType v1.NodeConditio
return isNodeConditionSetAsExpected(node, conditionType, wantTrue, true)
}

// IsConditionUnset returns true if conditions of the given node do not have a match to the given conditionType, otherwise false.
func IsConditionUnset(node *v1.Node, conditionType v1.NodeConditionType) bool {
Copy link
Member Author

Choose a reason for hiding this comment

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

this function is used only test/e2e/framework/node , so make it private.

for _, cond := range node.Status.Conditions {
// Ensure that the condition type and the status matches as desired.
if cond.Type == conditionType {
Copy link
Member Author

Choose a reason for hiding this comment

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

For line 75 and 77, This looks a little weird.
function IsConditionSetAsExpected and IsConditionSetAsExpectedSilent use isNodeConditionSetAsExpected,
and all values passed to conditionType are "NodeReady"

Copy link
Member

Choose a reason for hiding this comment

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

the two different function seem to wrap this one while passing silent=true/false.

but the diff here removes the check against conditionType, which makes the name of the function invalid.
i suggest this function is kept like that for now and only try to remove this TODO:

// TODO: better to change to a easy read name

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks your review. The code implementation here always feels a bit weird i feel.
how about this change now?

Copy link
Member

Choose a reason for hiding this comment

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

why modify the contents of the function?

Copy link
Member Author

Choose a reason for hiding this comment

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

see https://github.com/kubernetes/kubernetes/blob/master/test/e2e/framework/node/resource.go#L75 ,
if cond.Type == conditionType is true and cond.Type == v1.NodeReady is true, https://github.com/kubernetes/kubernetes/blob/master/test/e2e/framework/node/resource.go#L114 never run。
I think it is possible to judge this condition in advance, so move this code. If you don't think need to change it, I can revert it.I can just try to remove this TODO.

Copy link
Member

Choose a reason for hiding this comment

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

so in this PR i think we should only:

  • removed the TODO // TODO: better to change to a easy read name.
  • make the functions is....() private.

leave this TODO:

// TODO: check if the Node is tainted once we enable NC notReady/unreachable taints by default

to SIG Node and not touch it.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok

Copy link
Member Author

Choose a reason for hiding this comment

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

done,updated

}
return false
}
if (wantTrue && (cond.Status == v1.ConditionTrue)) || (!wantTrue && (cond.Status != v1.ConditionTrue)) {
// TODO: check if the Node is tainted once we enable NC notReady/unreachable taints by default
Copy link
Member

Choose a reason for hiding this comment

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

this TODO is for sig-node to resolve if they want to.
taint based eviction is enabled by default in 1.13:
https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/#taint-based-evictions

Copy link
Member Author

Choose a reason for hiding this comment

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

yes,i want to resolve this if i can in later.

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 21, 2020
@tanjunchen tanjunchen changed the title test/e2e/framework/node/:refactor function isNodeConditionSetAsExpected and and make some functions private test/e2e/framework/node/:remove TODO and and make some functions private Feb 21, 2020
@tanjunchen
Copy link
Member Author

/retest

Copy link
Member

@neolit123 neolit123 left a comment

Choose a reason for hiding this comment

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

thanks
/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 Feb 21, 2020
@neolit123
Copy link
Member

/retest

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: neolit123, tanjunchen

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 Feb 21, 2020
@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit 8ac7a5b into kubernetes:master Feb 22, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Feb 22, 2020
@tanjunchen tanjunchen deleted the remove-TODO-simplify-code branch February 22, 2020 03:44
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/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test 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. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants