refactor(backend): standardize errors and simplify configuration and test setup

This commit is contained in:
TakuyaYagam1 committed 2026-10-05 16:15:30 +03:00
1 parent 1535c19b8c
commit 138666a7bb
92 files changed
+3994 -210

No files matched your search

+5 -1
View File
@@ -2,6 +2,7 @@ package bootstrap
import (
"context"
"errors"
"net"
"net/http"
"strings"
@@ -44,9 +45,12 @@ func TestServeServersStopsBothListenersWhenOneFails(t *testing.T) {
&http.Server{Handler: http.NotFoundHandler()},
time.Second,
)
if err == nil || !strings.Contains(err.Error(), "API server stopped") {
if err == nil || !strings.HasPrefix(err.Error(), "bootstrap.serveServers - API server stopped: ") {
t.Fatalf("serveServers() error = %v, want API server failure", err)
}
if !errors.Is(err, net.ErrClosed) {
t.Fatalf("serveServers() lost the listener error: %v", err)
}
dialContext, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
defer cancel()
if _, err := (&net.Dialer{}).DialContext(dialContext, "tcp", metricsAddress); err == nil {