Skip to content

Commit

Permalink
Merge pull request etcd-io#19272 from jmao-dd/jmao/19216-flakey-promo…
Browse files Browse the repository at this point in the history
…te-learner-test

tests: Add retry if promote member fails.
  • Loading branch information
serathius authored Jan 26, 2025
2 parents 8731c31 + 692947a commit 532c601
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/e2e/runtime_reconfiguration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package e2e

import (
"context"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -178,6 +179,16 @@ func addMemberAsLearnerAndPromote(ctx context.Context, t *testing.T, epc *e2e.Et
id, err := epc.StartNewProc(ctx, nil, t, true /* addAsLearner */)
require.NoError(t, err)
_, err = epc.Etcdctl(e2e.WithEndpoints(endpoints)).MemberPromote(ctx, id)

attempt := 0
for attempt < 3 {
_, err = epc.Etcdctl(e2e.WithEndpoints(endpoints)).MemberPromote(ctx, id)
if err == nil || !strings.Contains(err.Error(), "can only promote a learner member which is in sync with leader") {
break
}
time.Sleep(100 * time.Millisecond)
attempt++
}
require.NoError(t, err)

newLearnerMemberProc := epc.Procs[len(epc.Procs)-1]
Expand Down

0 comments on commit 532c601

Please sign in to comment.