-
Notifications
You must be signed in to change notification settings - Fork 40.9k
refactor: merge TestSuspendJobControllerRestart and TestSuspendJob case to TestSuspendJob #132639
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
base: master
Are you sure you want to change the base?
Conversation
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: googs1025 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 |
2ba75cc
to
5630494
Compare
/test pull-kubernetes-integration |
e17a423
to
79d7c97
Compare
…se to TestSuspendJob Signed-off-by: googs1025 <[email protected]>
79d7c97
to
1a80ac9
Compare
/test pull-kubernetes-conformance-kind-ga-only-parallel |
featureGate bool | ||
create step | ||
update step | ||
isRestartCase bool |
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.
Actually, I looked up the PR adding the "restart case", because it looks like it is not testing restart now, check this: 1341e35#diff-ace35385ec6f5400e8ccbfe8e9f35c2f9573d0fc05889071dc9c4b36e5e975f7R368-R403.
So, it was introduced back when there was SuspendJob feature gate. I think now the name of the test is no longer relevant. We still may keep the test, but I wouldn't use isRestartCase
in the name.
Instead, I would suggest to extend the step
definition and add wantConditions
(replacing the more specific wantStatus and wantReason), wantReady
, and wantTerminating
.
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.
Let me try to understand(If there is any misunderstanding please tell me, thank you!):
- Delete the original TestSuspendJobControllerRestart test case, because it does not really test the behavior of the controller restart
- Keep the TestSuspendJob test case and add more verification fields in the step (remove
if tc.isRestartCase
part)
like this: 🤔
type step struct {
flag bool
wantActive int
wantReady int32
wantTerminating int32
wantConditions []batchv1.JobConditionType
}
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.
Almost, I think we can use batchv1.JobCondition
to assert also status and reason.
type step struct {
flag bool
wantActive int
wantReady int32
wantTerminating int32
wantConditions []batchv1.JobCondition
}
t.Run(name, func(t *testing.T) { | ||
tc := tc | ||
t.Run(tc.name, func(t *testing.T) { | ||
if tc.isRestartCase { |
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.
This looks like 2 separate tests squeezed into one. I would suggest to generalize the step
assertions as proposed in the other comment, and mix it into the main body of the test.
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR is related to:
fix #132621
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: