multi: add leader check to the healthcheck monitor

This commit extends our healtcheck with an optional leader check. This
is to ensure that given network partition or other cluster wide failure
we act as soon as possible to avoid a split-brain situation where a new
leader is elected but we still hold onto our etcd client.
This commit is contained in:
Andras Banki-Horvath committed 2024-08-01 19:04:10 +02:00
1 parent 7784d6abf6
commit 8e0534f756
8 files changed
+121 -12

No files matched your search

+2 -2
View File
@@ -87,12 +87,12 @@ func TestEtcdElector(t *testing.T) {
tmp := <-ch
first, err := tmp.Leader(ctxb)
require.NoError(t, err)
require.NoError(t, tmp.Resign())
require.NoError(t, tmp.Resign(ctxb))
tmp = <-ch
second, err := tmp.Leader(ctxb)
require.NoError(t, err)
require.NoError(t, tmp.Resign())
require.NoError(t, tmp.Resign(ctxb))
require.Contains(t, []string{id1, id2}, first)
require.Contains(t, []string{id1, id2}, second)