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 testcase to validate the reason of FitError #93770

Closed
wants to merge 1 commit into from

Conversation

chendave
Copy link
Member

@chendave chendave commented Aug 7, 2020

The error message should be rolled up into one line summary.

Signed-off-by: Dave Chen dave.chen@arm.com

What type of PR is this?

Add one of the following kinds:

/kind cleanup

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

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


@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 Aug 7, 2020
@chendave
Copy link
Member Author

chendave commented Aug 7, 2020

/sig scheduling

@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Aug 7, 2020
@chendave chendave force-pushed the fiterror_message branch 2 times, most recently from 0902b54 to 40a2970 Compare August 7, 2020 09:32
Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

Thanks

func TestFitErrorNoSpammy(t *testing.T) {
tests := []struct {
name string
nodeNum1 int
Copy link
Member

Choose a reason for hiding this comment

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

perhaps errorNodes and falseNodes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Both FakeFilter and FalseFilter used here will return unschedulable, errorNodes might not fit here.

node := &v1.Node{ObjectMeta: metav1.ObjectMeta{Name: uid, UID: types.UID(uid)}}
nodes = append(nodes, node)
cache.AddNode(node)
failedNodeReturnCodeMap[uid] = framework.Unschedulable
Copy link
Member

Choose a reason for hiding this comment

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

What was the map for? shouldn't this be framework.Error?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's mimic Unschedulable status and feasibleNodes is 0, so that FitError could be returned.

Copy link
Member Author

Choose a reason for hiding this comment

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

if it's not unschedulable status, it will not return FitError ,

if err != nil {
return result, err
}
trace.Step("Computing predicates done")
if len(feasibleNodes) == 0 {
return result, &framework.FitError{
Pod: pod,
NumAllNodes: g.nodeInfoSnapshot.NumNodes(),
Diagnosis: diagnosis,
}
}

and then the error message won't roll up to one line by below method,
func (f *FitError) Error()

pkg/scheduler/core/generic_scheduler_test.go Outdated Show resolved Hide resolved
pkg/scheduler/core/generic_scheduler_test.go Outdated Show resolved Hide resolved
pkg/scheduler/core/generic_scheduler_test.go Outdated Show resolved Hide resolved
Copy link
Member Author

@chendave chendave left a comment

Choose a reason for hiding this comment

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

@alculquicondor thanks for your great suggestion! either replied or addressed.

node := &v1.Node{ObjectMeta: metav1.ObjectMeta{Name: uid, UID: types.UID(uid)}}
nodes = append(nodes, node)
cache.AddNode(node)
failedNodeReturnCodeMap[uid] = framework.Unschedulable
Copy link
Member Author

Choose a reason for hiding this comment

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

it's mimic Unschedulable status and feasibleNodes is 0, so that FitError could be returned.

pkg/scheduler/core/generic_scheduler_test.go Outdated Show resolved Hide resolved
pkg/scheduler/core/generic_scheduler_test.go Outdated Show resolved Hide resolved
pkg/scheduler/core/generic_scheduler_test.go Outdated Show resolved Hide resolved
func TestFitErrorNoSpammy(t *testing.T) {
tests := []struct {
name string
nodeNum1 int
Copy link
Member Author

Choose a reason for hiding this comment

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

Both FakeFilter and FalseFilter used here will return unschedulable, errorNodes might not fit here.

@chendave
Copy link
Member Author

chendave commented Aug 9, 2020

/retest

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 7, 2020
@chendave
Copy link
Member Author

chendave commented Nov 9, 2020

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 9, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 7, 2021
The error message should be rolled up into one line summary.

Signed-off-by: Dave Chen <dave.chen@arm.com>
@chendave
Copy link
Member Author

chendave commented Mar 4, 2021

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 4, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chendave
To complete the pull request process, please assign huang-wei after the PR has been reviewed.
You can assign the PR to them by writing /assign @huang-wei in a comment when ready.

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

@chendave
Copy link
Member Author

chendave commented Mar 4, 2021

rebased.

@alculquicondor @ahg-g Does this one still have the chance to go?

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 4, 2021
Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

Sorry, I forgot about this PR.

So we are trying to test that the string representation of FitError is summarized. Why don't we directly test FitError.Error in the framework package? Or you can test recordSchedulingFailure in scheduler package sends the correct event message (I'm not sure if this is easy to test at unit level). TestGenericScheduler already tests that we return the correct FitError.

If your intent is to have a more E2E test, then the appropriate thing to do is to do it in the integration tests, where you can query the events and validate that message.

"FakeFilter",
st.NewFakeFilterPlugin(failedNodeReturnCodeMap),
),
st.RegisterFilterPlugin("FalseFilter", st.NewFalseFilterPlugin),
Copy link
Member

Choose a reason for hiding this comment

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

do we need this extra filter?

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, we need this filter.

I want to test the case that the pod cannot pass the filter with different reasons, pls see my this testcase,
cannot pass the filters with two different reasons

@chendave
Copy link
Member Author

chendave commented Mar 5, 2021

Why don't we directly test FitError.Error in the framework package?

Test in framework workable as well, but the whole testcase need to rewrite.

@alculquicondor
Copy link
Member

Just test the Error method

@chendave
Copy link
Member Author

chendave commented Mar 5, 2021

Just test the Error method

Got you, will come back for this later.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 3, 2021
@chendave
Copy link
Member Author

this is indeed a trivial change, no need to waste reviewer's time one this. so close.

/close

@k8s-ci-robot
Copy link
Contributor

@chendave: Closed this PR.

In response to this:

this is indeed a trivial change, no need to waste reviewer's time one this. so close.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. 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/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants