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

Function TestBasicTelemetryController_Success

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

Source from the content-addressed store, hash-verified

652}
653
654func TestBasicTelemetryController_Success(t *testing.T) {
655 t.Parallel()
656 ctx := testutil.Context(t, testutil.WaitShort)
657 logger := testutil.Logger(t)
658
659 uut := tailnet.NewBasicTelemetryController(logger)
660 ft := newFakeTelemetryClient()
661 uut.New(ft)
662
663 sendDone := make(chan struct{})
664 go func() {
665 defer close(sendDone)
666 uut.SendTelemetryEvent(&proto.TelemetryEvent{
667 Id: []byte("test event"),
668 })
669 }()
670
671 call := testutil.TryReceive(ctx, t, ft.calls)
672 require.Len(t, call.req.GetEvents(), 1)
673 require.Equal(t, call.req.GetEvents()[0].GetId(), []byte("test event"))
674
675 testutil.RequireSend(ctx, t, call.errCh, nil)
676 testutil.TryReceive(ctx, t, sendDone)
677}
678
679func TestBasicTelemetryController_Unimplemented(t *testing.T) {
680 t.Parallel()

Callers

nothing calls this directly

Calls 12

NewMethod · 0.95
SendTelemetryEventMethod · 0.95
ContextFunction · 0.92
LoggerFunction · 0.92
TryReceiveFunction · 0.92
RequireSendFunction · 0.92
newFakeTelemetryClientFunction · 0.85
GetEventsMethod · 0.80
LenMethod · 0.45
EqualMethod · 0.45
GetIdMethod · 0.45

Tested by

no test coverage detected