Skip to content

Conversation

@carreter
Copy link
Contributor

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Adds unit tests for how FailurePolicyActions should modify the JobSet status when applied.

Which issue(s) this PR fixes:

Fixes #963

Special notes for your reviewer:

Conflicts with #958 due to the status API change. Whichever PR gets merged second will have to be updated.

Test rigging written by hand, specific test cases generated with Gemini 2.5 Pro and manually edited to fix. Quite surprised at how well it worked, honestly.

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jul 31, 2025
@netlify
Copy link

netlify bot commented Jul 31, 2025

Deploy Preview for kubernetes-sigs-jobset canceled.

Name Link
🔨 Latest commit d6da828
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-jobset/deploys/689a12bd07130900087f32cd

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 31, 2025
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 31, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @carreter. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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 the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 31, 2025
@GiuseppeTT
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 31, 2025
@GiuseppeTT
Copy link
Contributor

/assign @GiuseppeTT

@GiuseppeTT
Copy link
Contributor

Conflicts with #958 due to the status API change. Whichever PR gets merged second will have to be updated.

I think it's best to merge #958 first. Besides, #958 looks ready for merging

@carreter
Copy link
Contributor Author

carreter commented Aug 1, 2025

Conflicts with #958 due to the status API change. Whichever PR gets merged second will have to be updated.

I think it's best to merge #958 first. Besides, #958 looks ready for merging

I'll make this stacked on top of #958 then!

@kannon92 kannon92 moved this to In Progress in Code to Review Aug 3, 2025
@kannon92 kannon92 moved this from In Progress to Todo in Code to Review Aug 3, 2025
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 4, 2025
@carreter carreter marked this pull request as draft August 4, 2025 19:22
@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 Aug 4, 2025
@carreter
Copy link
Contributor Author

carreter commented Aug 4, 2025

Rebased on top of #958 and converted to draft until #958 merges.

@GiuseppeTT
Copy link
Contributor

Rebased on top of #958 and converted to draft until #958 merges.

Let me know when it's ready for review. #958 just got merged

@carreter carreter force-pushed the failurepolicyaction-tests branch from 516e95a to 5a6323b Compare August 4, 2025 20:11
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 4, 2025
@carreter
Copy link
Contributor Author

carreter commented Aug 4, 2025

Sorry for the force-push, @GiuseppeTT this is ready for review.

@carreter carreter marked this pull request as ready for review August 4, 2025 20:12
@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 Aug 4, 2025
@GiuseppeTT
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 5, 2025
@GiuseppeTT
Copy link
Contributor

/assign @andreyvelich

@kannon92 kannon92 moved this from Todo to In Progress in Code to Review Aug 8, 2025
Copy link
Contributor

@kannon92 kannon92 left a comment

Choose a reason for hiding this comment

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

One very minor typo:

#967 (comment)

@github-project-automation github-project-automation bot moved this from In Progress to PR has requested changes in Code to Review Aug 8, 2025
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 8, 2025
@carreter carreter requested a review from kannon92 August 8, 2025 20:53
Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

Thank you for this @carreter!

matchingFailedJob *batchv1.Job
failurePolicyAction jobset.FailurePolicyAction
expectedJobSetStatus jobset.JobSetStatus
shouldUpdateStatusOpts bool
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 if that is always = true ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks for the catch!

@carreter carreter requested a review from andreyvelich August 11, 2025 15:57
t.Fatalf("unexpected error: %v", err)
}

if !updateStatusOpts.shouldUpdate {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a test case that doesn't require an update?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, all failure policies result in an update. I need to double-check though.

Copy link
Contributor

@kannon92 kannon92 left a comment

Choose a reason for hiding this comment

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

@github-project-automation github-project-automation bot moved this from PR has requested changes to Done in Code to Review Aug 11, 2025
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 11, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: carreter, kannon92

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 Aug 11, 2025
@k8s-ci-robot k8s-ci-robot merged commit a4da72d into kubernetes-sigs:main Aug 11, 2025
12 checks passed
@andreyvelich andreyvelich mentioned this pull request Aug 19, 2025
21 tasks
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. 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Failure policy action appliers need unit tests

5 participants