@@ -26,7 +26,7 @@ import (
26
26
27
27
func TestClientService_ServeClient_V2 (t * testing.T ) {
28
28
t .Parallel ()
29
- fCoord := newFakeCoordinator ()
29
+ fCoord := NewFakeCoordinator ()
30
30
var coord tailnet.Coordinator = fCoord
31
31
coordPtr := atomic.Pointer [tailnet.Coordinator ]{}
32
32
coordPtr .Store (& coord )
@@ -64,15 +64,15 @@ func TestClientService_ServeClient_V2(t *testing.T) {
64
64
})
65
65
require .NoError (t , err )
66
66
67
- call := testutil .RequireRecvCtx (ctx , t , fCoord .coordinateCalls )
67
+ call := testutil .RequireRecvCtx (ctx , t , fCoord .CoordinateCalls )
68
68
require .NotNil (t , call )
69
- require .Equal (t , call .id , clientID )
70
- require .Equal (t , call .name , "client" )
71
- require .True (t , call .auth .Authorize (agentID ))
72
- req := testutil .RequireRecvCtx (ctx , t , call .reqs )
69
+ require .Equal (t , call .ID , clientID )
70
+ require .Equal (t , call .Name , "client" )
71
+ require .True (t , call .Auth .Authorize (agentID ))
72
+ req := testutil .RequireRecvCtx (ctx , t , call .Reqs )
73
73
require .Equal (t , int32 (11 ), req .GetUpdateSelf ().GetNode ().GetPreferredDerp ())
74
74
75
- call .resps <- & proto.CoordinateResponse {PeerUpdates : []* proto.CoordinateResponse_PeerUpdate {
75
+ call .Resps <- & proto.CoordinateResponse {PeerUpdates : []* proto.CoordinateResponse_PeerUpdate {
76
76
{
77
77
Kind : proto .CoordinateResponse_PeerUpdate_NODE ,
78
78
Node : & proto.Node {PreferredDerp : 22 },
@@ -107,7 +107,7 @@ func TestClientService_ServeClient_V2(t *testing.T) {
107
107
108
108
func TestClientService_ServeClient_V1 (t * testing.T ) {
109
109
t .Parallel ()
110
- fCoord := newFakeCoordinator ()
110
+ fCoord := NewFakeCoordinator ()
111
111
var coord tailnet.Coordinator = fCoord
112
112
coordPtr := atomic.Pointer [tailnet.Coordinator ]{}
113
113
coordPtr .Store (& coord )
@@ -128,14 +128,14 @@ func TestClientService_ServeClient_V1(t *testing.T) {
128
128
errCh <- err
129
129
}()
130
130
131
- call := testutil .RequireRecvCtx (ctx , t , fCoord .serveClientCalls )
131
+ call := testutil .RequireRecvCtx (ctx , t , fCoord .ServeClientCalls )
132
132
require .NotNil (t , call )
133
- require .Equal (t , call .id , clientID )
134
- require .Equal (t , call .agent , agentID )
135
- require .Equal (t , s , call .conn )
133
+ require .Equal (t , call .ID , clientID )
134
+ require .Equal (t , call .Agent , agentID )
135
+ require .Equal (t , s , call .Conn )
136
136
expectedError := xerrors .New ("test error" )
137
137
select {
138
- case call .errCh <- expectedError :
138
+ case call .ErrCh <- expectedError :
139
139
// ok!
140
140
case <- ctx .Done ():
141
141
t .Fatalf ("timeout sending error" )
@@ -145,75 +145,75 @@ func TestClientService_ServeClient_V1(t *testing.T) {
145
145
require .ErrorIs (t , err , expectedError )
146
146
}
147
147
148
- type fakeCoordinator struct {
149
- coordinateCalls chan * fakeCoordinate
150
- serveClientCalls chan * fakeServeClient
148
+ type FakeCoordinator struct {
149
+ CoordinateCalls chan * FakeCoordinate
150
+ ServeClientCalls chan * FakeServeClient
151
151
}
152
152
153
- func (* fakeCoordinator ) ServeHTTPDebug (http.ResponseWriter , * http.Request ) {
153
+ func (* FakeCoordinator ) ServeHTTPDebug (http.ResponseWriter , * http.Request ) {
154
154
panic ("unimplemented" )
155
155
}
156
156
157
- func (* fakeCoordinator ) Node (uuid.UUID ) * tailnet.Node {
157
+ func (* FakeCoordinator ) Node (uuid.UUID ) * tailnet.Node {
158
158
panic ("unimplemented" )
159
159
}
160
160
161
- func (f * fakeCoordinator ) ServeClient (conn net.Conn , id uuid.UUID , agent uuid.UUID ) error {
161
+ func (f * FakeCoordinator ) ServeClient (conn net.Conn , id uuid.UUID , agent uuid.UUID ) error {
162
162
errCh := make (chan error )
163
- f .serveClientCalls <- & fakeServeClient {
164
- conn : conn ,
165
- id : id ,
166
- agent : agent ,
167
- errCh : errCh ,
163
+ f .ServeClientCalls <- & FakeServeClient {
164
+ Conn : conn ,
165
+ ID : id ,
166
+ Agent : agent ,
167
+ ErrCh : errCh ,
168
168
}
169
169
return <- errCh
170
170
}
171
171
172
- func (* fakeCoordinator ) ServeAgent (net.Conn , uuid.UUID , string ) error {
172
+ func (* FakeCoordinator ) ServeAgent (net.Conn , uuid.UUID , string ) error {
173
173
panic ("unimplemented" )
174
174
}
175
175
176
- func (* fakeCoordinator ) Close () error {
176
+ func (* FakeCoordinator ) Close () error {
177
177
panic ("unimplemented" )
178
178
}
179
179
180
- func (* fakeCoordinator ) ServeMultiAgent (uuid.UUID ) tailnet.MultiAgentConn {
180
+ func (* FakeCoordinator ) ServeMultiAgent (uuid.UUID ) tailnet.MultiAgentConn {
181
181
panic ("unimplemented" )
182
182
}
183
183
184
- func (f * fakeCoordinator ) Coordinate (ctx context.Context , id uuid.UUID , name string , a tailnet.TunnelAuth ) (chan <- * proto.CoordinateRequest , <- chan * proto.CoordinateResponse ) {
184
+ func (f * FakeCoordinator ) Coordinate (ctx context.Context , id uuid.UUID , name string , a tailnet.TunnelAuth ) (chan <- * proto.CoordinateRequest , <- chan * proto.CoordinateResponse ) {
185
185
reqs := make (chan * proto.CoordinateRequest , 100 )
186
186
resps := make (chan * proto.CoordinateResponse , 100 )
187
- f .coordinateCalls <- & fakeCoordinate {
188
- ctx : ctx ,
189
- id : id ,
190
- name : name ,
191
- auth : a ,
192
- reqs : reqs ,
193
- resps : resps ,
187
+ f .CoordinateCalls <- & FakeCoordinate {
188
+ Ctx : ctx ,
189
+ ID : id ,
190
+ Name : name ,
191
+ Auth : a ,
192
+ Reqs : reqs ,
193
+ Resps : resps ,
194
194
}
195
195
return reqs , resps
196
196
}
197
197
198
- func newFakeCoordinator () * fakeCoordinator {
199
- return & fakeCoordinator {
200
- coordinateCalls : make (chan * fakeCoordinate , 100 ),
201
- serveClientCalls : make (chan * fakeServeClient , 100 ),
198
+ func NewFakeCoordinator () * FakeCoordinator {
199
+ return & FakeCoordinator {
200
+ CoordinateCalls : make (chan * FakeCoordinate , 100 ),
201
+ ServeClientCalls : make (chan * FakeServeClient , 100 ),
202
202
}
203
203
}
204
204
205
- type fakeCoordinate struct {
206
- ctx context.Context
207
- id uuid.UUID
208
- name string
209
- auth tailnet.TunnelAuth
210
- reqs chan * proto.CoordinateRequest
211
- resps chan * proto.CoordinateResponse
205
+ type FakeCoordinate struct {
206
+ Ctx context.Context
207
+ ID uuid.UUID
208
+ Name string
209
+ Auth tailnet.TunnelAuth
210
+ Reqs chan * proto.CoordinateRequest
211
+ Resps chan * proto.CoordinateResponse
212
212
}
213
213
214
- type fakeServeClient struct {
215
- conn net.Conn
216
- id uuid.UUID
217
- agent uuid.UUID
218
- errCh chan error
214
+ type FakeServeClient struct {
215
+ Conn net.Conn
216
+ ID uuid.UUID
217
+ Agent uuid.UUID
218
+ ErrCh chan error
219
219
}
0 commit comments