MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / assertGetStatusCode

Function assertGetStatusCode

pkg/healthcheck/healthgo_test.go:160–169  ·  view source on GitHub ↗
(t *testing.T, a *assertions.Assertion, ln net.Listener, code int)

Source from the content-addressed store, hash-verified

158}
159
160func assertGetStatusCode(t *testing.T, a *assertions.Assertion, ln net.Listener, code int) {
161 t.Helper()
162 resp, err := http.Get(fmt.Sprintf("http://%v/healthz", ln.Addr()))
163 if !a.So(err, should.BeNil) {
164 t.FailNow()
165 }
166 defer resp.Body.Close()
167 defer io.Copy(io.Discard, resp.Body) // nolint:errcheck
168 a.So(resp.StatusCode, should.Equal, code)
169}
170
171func TestHealthCheckerWithPassingCheck(t *testing.T) {
172 t.Parallel()

Calls 4

GetMethod · 0.65
AddrMethod · 0.65
CloseMethod · 0.65
CopyMethod · 0.45

Tested by

no test coverage detected