(t *testing.T)
| 583 | } |
| 584 | |
| 585 | func 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 | |
| 608 | func TestNewBasicDERPController_RecvErr(t *testing.T) { |
| 609 | t.Parallel() |
nothing calls this directly
no test coverage detected