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

Function TestNewBasicDERPController_Mainline

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

Source from the content-addressed store, hash-verified

583}
584
585func TestNewBasicDERPController_Mainline(t *testing.T) {
586 t.Parallel()
587 fs := make(chan *tailcfg.DERPMap)
588 logger := testutil.Logger(t)
589 uut := tailnet.NewBasicDERPController(logger, nil, fakeSetter(fs))
590 fc := fakeDERPClient{
591 ch: make(chan *tailcfg.DERPMap),
592 }
593 c := uut.New(fc)
594 ctx := testutil.Context(t, testutil.WaitShort)
595 expectDM := &tailcfg.DERPMap{}
596 testutil.RequireSend(ctx, t, fc.ch, expectDM)
597 gotDM := testutil.TryReceive(ctx, t, fs)
598 require.Equal(t, expectDM, gotDM)
599 err := c.Close(ctx)
600 require.NoError(t, err)
601 err = testutil.TryReceive(ctx, t, c.Wait())
602 require.ErrorIs(t, err, io.EOF)
603 // ensure Close is idempotent
604 err = c.Close(ctx)
605 require.NoError(t, err)
606}
607
608func TestNewBasicDERPController_RecvErr(t *testing.T) {
609 t.Parallel()

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected