mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdmain: Honour ExperimentalWaitClusterReadyTimeout in startEtcd
When we can't reach quorum, we were waiting forever and never sending the systemd notify message. As a result, systemd would eventually time out and restart the etcd process which likely would make the unhealthy cluster in an even worse state Improves #13785 Signed-off-by: Nicolai Moore <niconorsk@gmail.com>
This commit is contained in:
@@ -15,9 +15,12 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
@@ -48,7 +51,7 @@ type EtcdProcess interface {
|
||||
}
|
||||
|
||||
type LogsExpect interface {
|
||||
Expect(string) (string, error)
|
||||
ExpectWithContext(context.Context, string) (string, error)
|
||||
Lines() []string
|
||||
LineCount() int
|
||||
}
|
||||
@@ -179,3 +182,14 @@ func (ep *EtcdServerProcess) Logs() LogsExpect {
|
||||
}
|
||||
return ep.proc
|
||||
}
|
||||
|
||||
func AssertProcessLogs(t *testing.T, ep EtcdProcess, expectLog string) {
|
||||
t.Helper()
|
||||
var err error
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
_, err = ep.Logs().ExpectWithContext(ctx, expectLog)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user