-
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
Flaking TestLeaseGrantTimeToLiveExpired
#17504
Labels
Comments
I think it's related to leader change. We can retry it 3 times if it's related to leader change.
|
Could you deliver a PR? thx |
@ahrtr sorry for taking it so long. I was distracted. I will file pull request when it's ready |
fuweid
added a commit
to fuweid/etcd
that referenced
this issue
Feb 24, 2025
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 <fuweid89@gmail.com>
fuweid
added a commit
to fuweid/etcd
that referenced
this issue
Feb 24, 2025
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 <fuweid89@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Which Github Action / Prow Jobs are flaking?
arm64 / test (linux-arm64-integration-1-cpu)
Which tests are flaking?
TestLeaseGrantTimeToLiveExpired
Github Action / Prow Job link
https://github.com/etcd-io/etcd/actions/runs/8078398584/job/22070629565
Reason for failure (if possible)
Anything else we need to know?
No response
The text was updated successfully, but these errors were encountered: