refactor: use mock transport in watch order tests and harden server timeouts

This commit is contained in:
2026-05-18 13:58:17 +02:00
parent a01207323f
commit a097410f40
3 changed files with 98 additions and 58 deletions

View File

@@ -0,0 +1,28 @@
package server
import (
"net/http"
"testing"
"time"
)
func TestNewHTTPServer_TimeoutsAndAddr(t *testing.T) {
srv := newHTTPServer(":1234", http.NewServeMux())
if srv.Addr != ":1234" {
t.Fatalf("Addr: got %q want %q", srv.Addr, ":1234")
}
if srv.ReadHeaderTimeout != 5*time.Second {
t.Fatalf("ReadHeaderTimeout: got %s want %s", srv.ReadHeaderTimeout, 5*time.Second)
}
if srv.ReadTimeout != 30*time.Second {
t.Fatalf("ReadTimeout: got %s want %s", srv.ReadTimeout, 30*time.Second)
}
if srv.WriteTimeout != 30*time.Second {
t.Fatalf("WriteTimeout: got %s want %s", srv.WriteTimeout, 30*time.Second)
}
if srv.IdleTimeout != 2*time.Minute {
t.Fatalf("IdleTimeout: got %s want %s", srv.IdleTimeout, 2*time.Minute)
}
}