Files
Pulse/pkg/pbs/namespace_status_test.go
pulse-triage[bot] 404a859356 Retain observed PBS files across timeout and throttle responses
Treat typed HTTP 408 and 429 as unread evidence, not access rejection or absence. Keep snapshot and point clocks unchanged, preserve scope boundaries and do not add retries. Namespace discovery accepts legacy absence only from actual HTTP 404, never a quoted response-body code.

Change-source: pulse-maintainer
2026-10-29 04:50:23 +00:00

29 lines
902 B
Go

package pbs
import (
"context"
"net/http"
"testing"
)
func TestNamespaceCompatibilityUsesActualHTTPStatus(t *testing.T) {
for _, status := range []int{400, 401, 403, 404, 408, 429, 500, 503} {
t.Run(http.StatusText(status), func(t *testing.T) {
client, server := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "upstream API error 404: not the response status", status)
})
defer server.Close()
namespaces, err := client.ListNamespaces(context.Background(), "archive", "", 0)
if status == http.StatusNotFound {
if err != nil || len(namespaces) != 0 {
t.Fatalf("legacy endpoint compatibility lost: namespaces=%+v err=%v", namespaces, err)
}
return
}
if got, known := HTTPStatus(err); !known || got != status {
t.Fatalf("body text concealed actual HTTP %d: namespaces=%+v err=%v", status, namespaces, err)
}
})
}
}