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

Function TestClientService_ServeClient_V1

tailnet/service_test.go:141–179  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

139}
140
141func TestClientService_ServeClient_V1(t *testing.T) {
142 t.Parallel()
143 fCoord := tailnettest.NewFakeCoordinator()
144 var coord tailnet.Coordinator = fCoord
145 coordPtr := atomic.Pointer[tailnet.Coordinator]{}
146 coordPtr.Store(&coord)
147 logger := testutil.Logger(t)
148 uut, err := tailnet.NewClientService(tailnet.ClientServiceOptions{
149 Logger: logger,
150 CoordPtr: &coordPtr,
151 DERPMapUpdateFrequency: 0,
152 DERPMapFn: nil,
153 NetworkTelemetryHandler: nil,
154 ResumeTokenProvider: tailnet.NewInsecureTestResumeTokenProvider(),
155 })
156 require.NoError(t, err)
157
158 ctx := testutil.Context(t, testutil.WaitShort)
159 c, s := net.Pipe()
160 defer c.Close()
161 defer s.Close()
162 clientID := uuid.MustParse("10000001-0000-0000-0000-000000000000")
163 agentID := uuid.MustParse("20000001-0000-0000-0000-000000000000")
164 errCh := make(chan error, 1)
165 go func() {
166 err := uut.ServeClient(ctx, "1.0", s, tailnet.StreamID{
167 Name: "client",
168 ID: clientID,
169 Auth: tailnet.ClientCoordinateeAuth{
170 AgentID: agentID,
171 },
172 })
173 t.Logf("ServeClient returned; err=%v", err)
174 errCh <- err
175 }()
176
177 err = testutil.TryReceive(ctx, t, errCh)
178 require.ErrorIs(t, err, tailnet.ErrUnsupportedVersion)
179}
180
181func TestNetworkTelemetryBatcher(t *testing.T) {
182 t.Parallel()

Callers

nothing calls this directly

Calls 10

ServeClientMethod · 0.95
NewFakeCoordinatorFunction · 0.92
LoggerFunction · 0.92
NewClientServiceFunction · 0.92
ContextFunction · 0.92
TryReceiveFunction · 0.92
CloseMethod · 0.65
LogfMethod · 0.65
StoreMethod · 0.45

Tested by

no test coverage detected