mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 11:30:15 +00:00
20 lines
601 B
Go
20 lines
601 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestRequestedOrgID_V5SingleTenantModeIgnoresHostAgentHeader(t *testing.T) {
|
|
prevSingleTenant := isV5SingleTenantMode()
|
|
setV5SingleTenantModeForTests(true)
|
|
t.Cleanup(func() { setV5SingleTenantModeForTests(prevSingleTenant) })
|
|
|
|
req := httptest.NewRequest(http.MethodGet, "/api/agents/host/lookup?hostname=missing-host", nil)
|
|
req.Header.Set("X-Pulse-Org-ID", "acme")
|
|
|
|
if got := requestedOrgID(req); got != "default" {
|
|
t.Fatalf("expected host agent path to collapse to default org in single-tenant mode, got %q", got)
|
|
}
|
|
}
|