Skip to content

Commit

Permalink
Backport corrupt check test fix "etcd server shouldn't wait for the r…
Browse files Browse the repository at this point in the history
…eady notification infinitely on startup"

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
  • Loading branch information
serathius committed Oct 17, 2023
1 parent 04cfb4c commit b3ecb90
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/e2e/corrupt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package e2e
import (
"context"
"fmt"
"sync"
"testing"
"time"

Expand Down Expand Up @@ -152,23 +153,31 @@ func TestInPlaceRecovery(t *testing.T) {
newCc := NewEtcdctl(epcNew.EndpointsV3(), clientNonTLS, false, false)
assert.NoError(t, err)

wg := sync.WaitGroup{}
// Rolling recovery of the servers.
t.Log("rolling updating servers in place...")
for i, newProc := range epcNew.procs {
for i := range epcNew.procs {
oldProc := epcOld.procs[i]
err = oldProc.Close()
if err != nil {
t.Fatalf("could not stop etcd process (%v)", err)
}
t.Logf("old cluster server %d: %s stopped.", i, oldProc.Config().name)
err = newProc.Start()
if err != nil {
t.Fatalf("could not start etcd process (%v)", err)
}
t.Logf("new cluster server %d: %s started in-place with blank db.", i, newProc.Config().name)
wg.Add(1)
// Start servers in background to avoid blocking on server start.
// EtcdProcess.Start waits until etcd becomes healthy, which will not happen here until we restart at least 2 members.
go func(proc etcdProcess) {
defer wg.Done()
err = proc.Start()
if err != nil {
t.Errorf("could not start etcd process (%v)", err)
}
t.Logf("new cluster server: %s started in-place with blank db.", proc.Config().name)
}(epcNew.procs[i])
t.Log("sleeping 5 sec to let nodes do periodical check...")
time.Sleep(5 * time.Second)
}
wg.Wait()
t.Log("new cluster started.")

alarmResponse, err := newCc.AlarmList()
Expand Down

0 comments on commit b3ecb90

Please sign in to comment.