Skip to content

🌱 Deflake certwatcher tests#3457

Merged
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
alvaroaleman:fix-flaky
Feb 16, 2026
Merged

🌱 Deflake certwatcher tests#3457
k8s-ci-robot merged 1 commit into
kubernetes-sigs:mainfrom
alvaroaleman:fix-flaky

Conversation

@alvaroaleman

Copy link
Copy Markdown
Member

In the certwatcher tests, we use start_watcher which starts the certwatcher in a goroutine. Once it is started, it sets up an fsnotify and reacts to events.

The metric test rely both on the gorouine starting fast enough and the fsnotify events being processed fast enough through eventually. In CI, the four second timeout that was used isn't always sufficient, resulting in flakes.

Given that there are dedicated tests for inotify event handling, this change changes the metric tests to explicitly call ReadCertificate and then validating the metrics.

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 15, 2026
Comment thread pkg/certwatcher/certwatcher_test.go Outdated

ctxCancel()
Eventually(doneCh, "4s").Should(BeClosed())
Expect(testutil.ToFloat64(metrics.ReadCertificateTotal)).To(BeNumerically(">=", readCertificateTotalBefore+1))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this still be >= or equals now?

(same below)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes of course, done

In the certwatcher tests, we use `start_watcher` which starts the
certwatcher in a goroutine. Once it is started, it sets up an fsnotify
and reacts to events.

The metric test rely both on the gorouine starting fast enough and the
fsnotify events being processed fast enough through eventually. In CI,
the four second timeout that was used isn't always sufficient, resulting
in flakes.

Given that there are dedicated tests for inotify event handling, this change
changes the metric tests to explicitly call `ReadCertificate` and then
validating the metrics.
@sbueringer

Copy link
Copy Markdown
Member

Thx!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 16, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 7ed712827edef3da760b47cfdcd83a34761e8d43

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, sbueringer

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:
  • OWNERS [alvaroaleman,sbueringer]

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 merged commit e4c1c38 into kubernetes-sigs:main Feb 16, 2026
9 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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants