-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
tests: deflakey TestLeaseGrantTimeToLiveExpired #19476
Conversation
The following change can reproduce the issue etcd-io#17504 by `TESTCASE=TestLeaseGrantTimeToLiveExpired/PeerAutoTLS make test-e2e`. We can retry it to reduce flakey possibility, if there is leader change. ```diff diff --git a/tests/common/lease_test.go b/tests/common/lease_test.go index afb27c330..dea8459dc 100644 --- a/tests/common/lease_test.go +++ b/tests/common/lease_test.go @@ -16,6 +16,7 @@ package common import ( "context" + "sync" "testing" "time" @@ -139,6 +140,18 @@ func TestLeaseGrantTimeToLiveExpired(t *testing.T) { require.NoError(t, err) require.Equal(t, int64(1), getResp.Count) + var wg sync.WaitGroup + defer wg.Wait() + + wg.Add(1) + go func() { + defer wg.Done() + time.Sleep(1000 * time.Millisecond) + clus.(interface { + MoveLeader(ctx context.Context, t testing.TB, i int) error + }).MoveLeader(ctx, t, (clus.WaitLeader(t)+1)%len(clus.Members())) + }() + time.Sleep(3 * time.Second) ttlResp, err := cc.TimeToLive(ctx, leaseResp.ID, config.LeaseOption{}) ``` Signed-off-by: Wei Fu <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted filessee 21 files with indirect coverage changes @@ Coverage Diff @@
## main #19476 +/- ##
==========================================
+ Coverage 68.89% 68.91% +0.02%
==========================================
Files 420 420
Lines 35762 35762
==========================================
+ Hits 24638 24646 +8
+ Misses 9699 9690 -9
- Partials 1425 1426 +1 Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for deflaking the test.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahrtr, fuweid, serathius The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Thanks for the good catch! |
/cherry-pick release-3.6 |
/cherry-pick release-3.5 |
@ahrtr: #19476 failed to apply on top of branch "release-3.6":
In response to this:
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. |
@ahrtr: #19476 failed to apply on top of branch "release-3.5":
In response to this:
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. |
The following change can reproduce the issue #17504 by
TESTCASE=TestLeaseGrantTimeToLiveExpired/PeerAutoTLS make test-e2e
. We can retry it to reduce flakey possibility, if there is leader change.Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.