(t *testing.T)
| 39 | var errUnimplemented = drpcerr.WithCode(xerrors.New("Unimplemented"), drpcerr.Unimplemented) |
| 40 | |
| 41 | func TestInMemoryCoordination(t *testing.T) { |
| 42 | t.Parallel() |
| 43 | ctx := testutil.Context(t, testutil.WaitShort) |
| 44 | logger := testutil.Logger(t) |
| 45 | clientID := uuid.UUID{1} |
| 46 | agentID := uuid.UUID{2} |
| 47 | mCoord := tailnettest.NewMockCoordinator(gomock.NewController(t)) |
| 48 | fConn := &fakeCoordinatee{} |
| 49 | |
| 50 | reqs := make(chan *proto.CoordinateRequest, 100) |
| 51 | resps := make(chan *proto.CoordinateResponse, 100) |
| 52 | auth := tailnet.ClientCoordinateeAuth{AgentID: agentID} |
| 53 | mCoord.EXPECT().Coordinate(gomock.Any(), clientID, gomock.Any(), auth). |
| 54 | Times(1).Return(reqs, resps) |
| 55 | |
| 56 | ctrl := tailnet.NewTunnelSrcCoordController(logger, fConn) |
| 57 | ctrl.AddDestination(agentID) |
| 58 | uut := ctrl.New(tailnet.NewInMemoryCoordinatorClient(logger, clientID, auth, mCoord)) |
| 59 | defer uut.Close(ctx) |
| 60 | |
| 61 | coordinationTest(ctx, t, uut, fConn, reqs, resps, agentID) |
| 62 | |
| 63 | // Recv loop should be terminated by the server hanging up after Disconnect |
| 64 | err := testutil.TryReceive(ctx, t, uut.Wait()) |
| 65 | require.ErrorIs(t, err, io.EOF) |
| 66 | } |
| 67 | |
| 68 | func TestTunnelSrcCoordController_Mainline(t *testing.T) { |
| 69 | t.Parallel() |
nothing calls this directly
no test coverage detected