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:
houyuwushang
2026-10-21 11:34:41 +08:00
committed by GitHub
parent 0fe7b08fbb
commit 3cbe6b5269
8 changed files with 250 additions and 12 deletions

View File

@@ -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)