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

Function TestContextDeadlineExceeded

pkg/errors/errors_test.go:96–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestContextDeadlineExceeded(t *testing.T) {
97 t.Parallel()
98 a := assertions.New(t)
99
100 ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(5*time.Millisecond))
101 defer cancel()
102
103 <-ctx.Done()
104
105 err, ok := errors.From(ctx.Err())
106 if !a.So(ok, should.BeTrue) {
107 t.FailNow()
108 }
109 a.So(errors.IsDeadlineExceeded(err), should.BeTrue)
110}
111
112func TestNetErrors(t *testing.T) {
113 t.Parallel()

Callers

nothing calls this directly

Calls 7

FromFunction · 0.92
IsDeadlineExceededFunction · 0.92
DoneMethod · 0.80
NewMethod · 0.65
AddMethod · 0.65
NowMethod · 0.65
ErrMethod · 0.45

Tested by

no test coverage detected