mirror of
https://github.com/coredns/coredns.git
synced 2026-10-27 04:35:43 -04:00
plugin/forward: add startup health checks with start_failed (#8663)
* plugin/forward: add startup health checks with start_failed Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com> * test: separate CoreDNS and third-party imports Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com> --------- Signed-off-by: houyuwushang <180804215+houyuwushang@users.noreply.github.com>
This commit is contained in:
@@ -33,11 +33,15 @@ func TestHealth(t *testing.T) {
|
||||
hc.SetWriteTimeout(10 * time.Millisecond)
|
||||
|
||||
p := NewProxy("TestHealth", s.Addr, transport.DNS)
|
||||
p.initiallyDown.Store(true)
|
||||
p.readTimeout = 10 * time.Millisecond
|
||||
err := hc.Check(p)
|
||||
if err != nil {
|
||||
t.Errorf("check failed: %v", err)
|
||||
}
|
||||
if p.Down(2) {
|
||||
t.Error("successful DNS health check did not clear startup failure")
|
||||
}
|
||||
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
i1 := atomic.LoadUint32(&i)
|
||||
@@ -110,11 +114,15 @@ func TestHealthHTTPS(t *testing.T) {
|
||||
hc.SetWriteTimeout(1 * time.Second)
|
||||
|
||||
p := NewProxy("TestHealthHTTPS", s.URL, transport.HTTPS)
|
||||
p.initiallyDown.Store(true)
|
||||
p.readTimeout = 10 * time.Millisecond
|
||||
err := hc.Check(p)
|
||||
if err != nil {
|
||||
t.Fatalf("check failed: %v", err)
|
||||
}
|
||||
if p.Down(2) {
|
||||
t.Error("successful HTTPS health check did not clear startup failure")
|
||||
}
|
||||
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
i1 := atomic.LoadUint32(&i)
|
||||
|
||||
Reference in New Issue
Block a user