Skip to content

[release-1.21] fix(scheduler): drop the mock clock and drive tests with synctest (#9248) - #9311

Merged
cert-manager-prow[bot] merged 1 commit into
cert-manager:release-1.21from
cert-manager-bot:cherry-pick-9267-to-release-1.21
Sep 8, 2026
Merged

cert-manager-prow[bot] merged 1 commit into
cert-manager:release-1.21from
cert-manager-bot:cherry-pick-9267-to-release-1.21

Conversation

@cert-manager-bot

Copy link
Copy Markdown
Contributor

This is an automated cherry-pick of #9267

/assign wallrj

NONE

…rt-manager#9248)

The scheduledWorkQueue.afterFunc field was added for testing purposes in
cert-manager#4233, but Add never used it, so tests ran against real timers and
TestAdd raced on the mock clock state under -race.

Rather than wiring the dead hook up, delete it: with Go 1.26 the tests
can use testing/synctest, which drives the real afterFunc through
k8s.io/utils clock.RealClock deterministically. This removes the
unsynchronised mockAfter bookkeeping that cert-manager#9248 flagged, makes the
"fired early" check actually fail when Add mis-schedules, and catches
goroutine leaks without runtime.NumGoroutine counting.

Fixes cert-manager#9248

Signed-off-by: Shashank Varma <[email protected]>
@cert-manager-prow cert-manager-prow Bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 8, 2026
@wallrj wallrj mentioned this pull request Sep 8, 2026
39 of 41 tasks
@wallrj

wallrj commented Sep 8, 2026

Copy link
Copy Markdown
Member

Automated cherry-pick of #9267, test-only, applied without conflicts and CI is green on release-1.21. It is needed so that the regression test in #9312 compiles on this branch. Merging this first, then retesting #9312.

/kind bug
/approve
/lgtm
/label tide/merge-method-squash

[Claude Fable 5.1]

@cert-manager-prow cert-manager-prow Bot added kind/bug Categorizes issue or PR as related to a bug. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. lgtm Indicates that a PR is ready to be merged. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Sep 8, 2026
@cert-manager-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wallrj

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

@cert-manager-prow cert-manager-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 8, 2026
@cert-manager-prow
cert-manager-prow Bot merged commit 9473e34 into cert-manager:release-1.21 Sep 8, 2026
6 checks passed
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. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants