Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
35 lines
942 B
Go
35 lines
942 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestNewHTTPServerTimeouts(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
handler := http.HandlerFunc(func(http.ResponseWriter, *http.Request) {})
|
|
srv := newHTTPServer(":0", handler)
|
|
|
|
if srv.Addr != ":0" {
|
|
t.Fatalf("Addr = %q, want :0", srv.Addr)
|
|
}
|
|
if srv.Handler == nil {
|
|
t.Fatal("Handler is nil")
|
|
}
|
|
if got, want := srv.ReadHeaderTimeout, 10*time.Second; got != want {
|
|
t.Fatalf("ReadHeaderTimeout = %v, want %v", got, want)
|
|
}
|
|
if got, want := srv.ReadTimeout, 60*time.Second; got != want {
|
|
t.Fatalf("ReadTimeout = %v, want %v", got, want)
|
|
}
|
|
// Long WriteTimeout preserves streaming feed exports/sync; must stay >> typical JSON handlers.
|
|
if got, want := srv.WriteTimeout, 15*time.Minute; got != want {
|
|
t.Fatalf("WriteTimeout = %v, want %v", got, want)
|
|
}
|
|
if got, want := srv.IdleTimeout, 120*time.Second; got != want {
|
|
t.Fatalf("IdleTimeout = %v, want %v", got, want)
|
|
}
|
|
}
|