Skip to content

WIP: Demonstrate that flaky leader election healthz adaptor tests are fixed - #6020

Closed
wallrj wants to merge 10 commits into
cert-manager:masterfrom
wallrj:remove-leaderelection-healthz-adaptor-tests
Closed

wallrj wants to merge 10 commits into
cert-manager:masterfrom
wallrj:remove-leaderelection-healthz-adaptor-tests

Conversation

@wallrj

@wallrj wallrj commented May 5, 2023 •

Copy link
Copy Markdown
Member

A temporary PR to demonstrate that the flakey tests are fixed by #6022
even with the latest version of client-go:

I ran all the tests 10 times without flakes, after this change:

$ ~/go/bin/go test ./pkg/healthz/... -count 10
ok      github.com/cert-manager/cert-manager/pkg/healthz        9.558s

And without this change you can see that they fail reliably:

$ ~/go/bin/go test ./pkg/healthz/... -count 10
I0505 14:12:28.156464  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:28.156501  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:28.156538  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:28.156567  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:28.156575  120104 leaderelection.go:255] successfully acquired lease fake-resource-lock
E0505 14:12:28.156668  120104 leaderelection.go:364] Failed to update lock: simulated-update-error
I0505 14:12:28.156732  120104 leaderelection.go:255] successfully acquired lease fake-resource-lock
E0505 14:12:28.156967  120104 leaderelection.go:364] Failed to update lock: simulated-delayed-update-error
E0505 14:12:28.459009  120104 leaderelection.go:364] Failed to update lock: simulated-delayed-update-error
I0505 14:12:28.557030  120104 leaderelection.go:280] failed to renew lease fake-resource-lock: timed out waiting for the condition
E0505 14:12:28.586977  120104 leaderelection.go:364] Failed to update lock: simulated-update-error
E0505 14:12:28.987472  120104 leaderelection.go:364] Failed to update lock: simulated-update-error
I0505 14:12:29.158135  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
E0505 14:12:29.158242  120104 leaderelection.go:364] Failed to update lock: simulated-update-error
I0505 14:12:29.158250  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:29.158146  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:29.158369  120104 leaderelection.go:255] successfully acquired lease fake-resource-lock
I0505 14:12:29.158255  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:29.158579  120104 leaderelection.go:255] successfully acquired lease fake-resource-lock
E0505 14:12:29.459666  120104 leaderelection.go:364] Failed to update lock: simulated-delayed-update-error
I0505 14:12:29.660919  120104 leaderelection.go:280] failed to renew lease fake-resource-lock: timed out waiting for the condition
I0505 14:12:29.664012  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:29.664054  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:29.664110  120104 leaderelection.go:255] successfully acquired lease fake-resource-lock
E0505 14:12:29.664127  120104 leaderelection.go:364] Failed to update lock: simulated-update-error
I0505 14:12:29.664032  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:29.665411  120104 leaderelection.go:245] attempting to acquire leader lease fake-resource-lock...
I0505 14:12:29.665505  120104 leaderelection.go:255] successfully acquired lease fake-resource-lock
E0505 14:12:29.965092  120104 leaderelection.go:364] Failed to update lock: simulated-delayed-update-error
I0505 14:12:30.149088  120104 leaderelection.go:255] successfully acquired lease fake-resource-lock
panic: close of closed channel

goroutine 286 [running]:
github.com/cert-manager/cert-manager/pkg/healthz_test.TestHealthzLivezLeaderElection.func2.1.3({0x1626ddc, 0xa})
        /home/richard/projects/cert-manager/cert-manager/pkg/healthz/healthz_test.go:248 +0x106
created by k8s.io/client-go/tools/leaderelection.(*LeaderElector).maybeReportTransition
        /home/richard/go/pkg/mod/k8s.io/[email protected]/tools/leaderelection/leaderelection.go:378 +0x105
FAIL    github.com/cert-manager/cert-manager/pkg/healthz        2.010s
FAIL
NONE

lucacome and others added 9 commits May 4, 2023 16:50
Signed-off-by: Luca Comellini <[email protected]>
Signed-off-by: Luca Comellini <[email protected]>
To work with latest controller runtime

Signed-off-by: irbekrm <[email protected]>
Signed-off-by: irbekrm <[email protected]>
Signed-off-by: irbekrm <[email protected]>
@jetstack-bot jetstack-bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. labels May 5, 2023
@jetstack-bot

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

@jetstack-bot jetstack-bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 5, 2023
@wallrj
wallrj force-pushed the remove-leaderelection-healthz-adaptor-tests branch from 11d51ce to 8dc837c Compare May 5, 2023 12:45
@jetstack-bot jetstack-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 5, 2023
@wallrj
wallrj force-pushed the remove-leaderelection-healthz-adaptor-tests branch from 8dc837c to b81d3ca Compare May 5, 2023 12:57
@jetstack-bot jetstack-bot added area/acme Indicates a PR directly modifies the ACME Issuer code area/testing Issues relating to testing size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 5, 2023
@wallrj wallrj changed the title WIP: Fix / remove flaky leader election healthz adaptor tests WIP: Demonstrate that flaky leader election healthz adaptor tests are fixed May 5, 2023
Fixes test flakes caused by the local node taking over leadership,
because it did not observe any change in the leader election record held by the
remote node.

Signed-off-by: Richard Wall <[email protected]>
@wallrj
wallrj force-pushed the remove-leaderelection-healthz-adaptor-tests branch from b81d3ca to 67f86c7 Compare May 5, 2023 15:10
@jetstack-bot

Copy link
Copy Markdown
Contributor

@wallrj: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cert-manager-master-make-test 67f86c7 link true /test pull-cert-manager-master-make-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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/test-infra repository. I understand the commands that are listed here.

@wallrj

wallrj commented May 5, 2023

Copy link
Copy Markdown
Member Author

Closing this PR which was only used for demonstrating that the flakey tests had been fixed when combined with latest K8S libraries.

@wallrj wallrj closed this May 5, 2023
@wallrj
wallrj deleted the remove-leaderelection-healthz-adaptor-tests branch May 5, 2023 15:40
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. area/acme Indicates a PR directly modifies the ACME Issuer code area/testing Issues relating to testing dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants