MCPcopy
hub / github.com/caddyserver/caddy / TestAdminUpstreamsEmpty

Function TestAdminUpstreamsEmpty

modules/caddyhttp/reverseproxy/admin_test.go:117–127  ·  view source on GitHub ↗

TestAdminUpstreamsEmpty verifies that an empty response is valid JSON when no upstreams are registered.

(t *testing.T)

Source from the content-addressed store, hash-verified

115// TestAdminUpstreamsEmpty verifies that an empty response is valid JSON when
116// no upstreams are registered.
117func TestAdminUpstreamsEmpty(t *testing.T) {
118 resetDynamicHosts()
119
120 results := callAdminUpstreams(t)
121 if results == nil {
122 t.Error("expected non-nil (empty) slice, got nil")
123 }
124 if len(results) != 0 {
125 t.Errorf("expected 0 results with empty pools, got %d", len(results))
126 }
127}
128
129// TestAdminUpstreamsStaticOnly verifies that static upstreams (from the
130// UsagePool) appear in the response with correct addresses.

Callers

nothing calls this directly

Calls 3

resetDynamicHostsFunction · 0.85
callAdminUpstreamsFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected