@@ -230,12 +230,6 @@ func TestUpdateStates(t *testing.T) {
230
230
TemplateName : template .Name ,
231
231
}, nil )
232
232
233
- // Workspace last used at gets bumped.
234
- dbM .EXPECT ().UpdateWorkspaceLastUsedAt (gomock .Any (), database.UpdateWorkspaceLastUsedAtParams {
235
- ID : workspace .ID ,
236
- LastUsedAt : now ,
237
- }).Return (nil )
238
-
239
233
_ , err := api .UpdateStats (context .Background (), req )
240
234
require .NoError (t , err )
241
235
})
@@ -319,6 +313,7 @@ func TestUpdateStates(t *testing.T) {
319
313
"dean" : 2 ,
320
314
},
321
315
ConnectionCount : 3 ,
316
+ SessionCountSsh : 3 ,
322
317
},
323
318
}
324
319
)
@@ -355,7 +350,7 @@ func TestUpdateStates(t *testing.T) {
355
350
TemplateName : template .Name ,
356
351
}, nil )
357
352
358
- // We expect an activity bump because ConnectionCount > 0. However, the
353
+ // We expect an activity bump because SessionCountSsh > 0. However, the
359
354
// next autostart time will be set on the bump.
360
355
dbM .EXPECT ().ActivityBumpWorkspace (gomock .Any (), database.ActivityBumpWorkspaceParams {
361
356
WorkspaceID : workspace .ID ,
@@ -466,29 +461,9 @@ func TestUpdateStates(t *testing.T) {
466
461
TemplateName : template .Name ,
467
462
}, nil )
468
463
469
- // We expect an activity bump because ConnectionCount > 0.
470
- dbM .EXPECT ().ActivityBumpWorkspace (gomock .Any (), database.ActivityBumpWorkspaceParams {
471
- WorkspaceID : workspace .ID ,
472
- NextAutostart : time.Time {}.UTC (),
473
- }).Return (nil )
474
-
475
- // Workspace last used at gets bumped.
476
- dbM .EXPECT ().UpdateWorkspaceLastUsedAt (gomock .Any (), database.UpdateWorkspaceLastUsedAtParams {
477
- ID : workspace .ID ,
478
- LastUsedAt : now ,
479
- }).Return (nil )
480
-
481
464
// User gets fetched to hit the UpdateAgentMetricsFn.
482
465
dbM .EXPECT ().GetUserByID (gomock .Any (), user .ID ).Return (user , nil )
483
466
484
- // Ensure that pubsub notifications are sent.
485
- notifyDescription := make (chan []byte )
486
- ps .Subscribe (codersdk .WorkspaceNotifyChannel (workspace .ID ), func (_ context.Context , description []byte ) {
487
- go func () {
488
- notifyDescription <- description
489
- }()
490
- })
491
-
492
467
resp , err := api .UpdateStats (context .Background (), req )
493
468
require .NoError (t , err )
494
469
require .Equal (t , & agentproto.UpdateStatsResponse {
@@ -502,13 +477,6 @@ func TestUpdateStates(t *testing.T) {
502
477
require .EqualValues (t , 0 , batcher .LastStats .SessionCountJetbrains )
503
478
require .EqualValues (t , 0 , batcher .LastStats .SessionCountVscode )
504
479
require .EqualValues (t , 0 , batcher .LastStats .SessionCountReconnectingPty )
505
- ctx := testutil .Context (t , testutil .WaitShort )
506
- select {
507
- case <- ctx .Done ():
508
- t .Error ("timed out while waiting for pubsub notification" )
509
- case description := <- notifyDescription :
510
- require .Equal (t , description , []byte {})
511
- }
512
480
require .True (t , updateAgentMetricsFnCalled )
513
481
})
514
482
}
0 commit comments