-
Notifications
You must be signed in to change notification settings - Fork 39.4k
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
Conversation
/sig scheduling |
0902b54
to
40a2970
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps errorNodes
and falseNodes
?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
,
kubernetes/pkg/scheduler/core/generic_scheduler.go
Lines 111 to 122 in 4f93175
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()
40a2970
to
66e892e
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
func TestFitErrorNoSpammy(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
nodeNum1 int |
There was a problem hiding this comment.
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.
/retest |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
The error message should be rolled up into one line summary. Signed-off-by: Dave Chen <dave.chen@arm.com>
/remove-lifecycle stale |
66e892e
to
e26664c
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: chendave 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 |
rebased. @alculquicondor @ahg-g Does this one still have the chance to go? |
There was a problem hiding this 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), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Test in framework workable as well, but the whole testcase need to rewrite. |
Just test the |
Got you, will come back for this later. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
this is indeed a trivial change, no need to waste reviewer's time one this. so close. /close |
@chendave: Closed this PR. In response to this:
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. |
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?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: