MCPcopy Index your code
hub / github.com/coder/coder / TestNewBasicDERPController_RecvErr

Function TestNewBasicDERPController_RecvErr

tailnet/controllers_test.go:608–625  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

606}
607
608func TestNewBasicDERPController_RecvErr(t *testing.T) {
609 t.Parallel()
610 fs := make(chan *tailcfg.DERPMap)
611 logger := testutil.Logger(t)
612 uut := tailnet.NewBasicDERPController(logger, nil, fakeSetter(fs))
613 expectedErr := xerrors.New("a bad thing happened")
614 fc := fakeDERPClient{
615 ch: make(chan *tailcfg.DERPMap),
616 err: expectedErr,
617 }
618 c := uut.New(fc)
619 ctx := testutil.Context(t, testutil.WaitShort)
620 err := testutil.TryReceive(ctx, t, c.Wait())
621 require.ErrorIs(t, err, expectedErr)
622 // ensure Close is idempotent
623 err = c.Close(ctx)
624 require.NoError(t, err)
625}
626
627type fakeSetter chan *tailcfg.DERPMap
628

Callers

nothing calls this directly

Calls 8

LoggerFunction · 0.92
NewBasicDERPControllerFunction · 0.92
ContextFunction · 0.92
TryReceiveFunction · 0.92
fakeSetterTypeAlias · 0.85
NewMethod · 0.65
WaitMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected