@@ -15,6 +15,7 @@ import (
15
15
"golang.org/x/exp/slices"
16
16
"golang.org/x/xerrors"
17
17
"google.golang.org/protobuf/types/known/durationpb"
18
+ "google.golang.org/protobuf/types/known/emptypb"
18
19
"storj.io/drpc/drpcmux"
19
20
"storj.io/drpc/drpcserver"
20
21
"tailscale.com/tailcfg"
@@ -170,6 +171,7 @@ type FakeAgentAPI struct {
170
171
lifecycleStates []codersdk.WorkspaceAgentLifecycle
171
172
metadata map [string ]agentsdk.Metadata
172
173
timings []* agentproto.Timing
174
+ connections []* agentproto.Connection
173
175
174
176
getAnnouncementBannersFunc func () ([]codersdk.BannerConfig , error )
175
177
getResourcesMonitoringConfigurationFunc func () (* agentproto.GetResourcesMonitoringConfigurationResponse , error )
@@ -338,12 +340,20 @@ func (f *FakeAgentAPI) BatchCreateLogs(ctx context.Context, req *agentproto.Batc
338
340
339
341
func (f * FakeAgentAPI ) ScriptCompleted (_ context.Context , req * agentproto.WorkspaceAgentScriptCompletedRequest ) (* agentproto.WorkspaceAgentScriptCompletedResponse , error ) {
340
342
f .Lock ()
341
- f .timings = append (f .timings , req .Timing )
343
+ f .timings = append (f .timings , req .GetTiming () )
342
344
f .Unlock ()
343
345
344
346
return & agentproto.WorkspaceAgentScriptCompletedResponse {}, nil
345
347
}
346
348
349
+ func (f * FakeAgentAPI ) ReportConnection (_ context.Context , req * agentproto.ReportConnectionRequest ) (* emptypb.Empty , error ) {
350
+ f .Lock ()
351
+ f .connections = append (f .connections , req .GetConnection ())
352
+ f .Unlock ()
353
+
354
+ return & emptypb.Empty {}, nil
355
+ }
356
+
347
357
func NewFakeAgentAPI (t testing.TB , logger slog.Logger , manifest * agentproto.Manifest , statsCh chan * agentproto.Stats ) * FakeAgentAPI {
348
358
return & FakeAgentAPI {
349
359
t : t ,
0 commit comments