Skip to content

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

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

Conversation

googs1025
Copy link
Member

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?

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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 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. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jul 1, 2025
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/test sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jul 1, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage in SIG Apps Jul 1, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: googs1025
Once this PR has been reviewed and has the lgtm label, please assign soltysh for approval. For more information see the 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 requested review from kow3ns and soltysh July 1, 2025 02:45
@googs1025
Copy link
Member Author

cc @mimowo @tenzen-y

@googs1025 googs1025 marked this pull request as draft July 1, 2025 04:01
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 1, 2025
@googs1025 googs1025 force-pushed the chore/job_integrationtest branch from 2ba75cc to 5630494 Compare July 1, 2025 04:04
@googs1025
Copy link
Member Author

/test pull-kubernetes-integration

@googs1025 googs1025 force-pushed the chore/job_integrationtest branch 2 times, most recently from e17a423 to 79d7c97 Compare July 1, 2025 05:28
@googs1025 googs1025 marked this pull request as ready for review July 1, 2025 05:49
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 1, 2025
@k8s-ci-robot k8s-ci-robot requested a review from krmayankk July 1, 2025 05:49
@googs1025
Copy link
Member Author

/test pull-kubernetes-conformance-kind-ga-only-parallel

featureGate bool
create step
update step
isRestartCase bool
Copy link
Contributor

@mimowo mimowo Jul 1, 2025

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.

Copy link
Member Author

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!):

  1. Delete the original TestSuspendJobControllerRestart test case, because it does not really test the behavior of the controller restart
  2. 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
}

Copy link
Contributor

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 {
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

Job: Consolidate Suspend related operation Integration Tests into one
3 participants