Skip to content

Commit 6ec178b

Browse files
committed
fix issues
1 parent d709e68 commit 6ec178b

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

coderd/database/dbfake/dbfake.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4309,7 +4309,7 @@ func (q *FakeQuerier) InsertWorkspaceApp(_ context.Context, arg database.InsertW
43094309
return workspaceApp, nil
43104310
}
43114311

4312-
func (q *FakeQuerier) InsertWorkspaceAppStats(ctx context.Context, arg database.InsertWorkspaceAppStatsParams) error {
4312+
func (q *FakeQuerier) InsertWorkspaceAppStats(_ context.Context, arg database.InsertWorkspaceAppStatsParams) error {
43134313
err := validateDatabaseType(arg)
43144314
if err != nil {
43154315
return err

coderd/workspaceapps/stats_test.go

+6-9
Original file line numberDiff line numberDiff line change
@@ -320,17 +320,14 @@ func TestStatsCollector(t *testing.T) {
320320
}, testutil.WaitMedium, testutil.IntervalFast)
321321

322322
// Order is not guaranteed.
323-
sortBySessionID := func(a, b workspaceapps.StatsReport) bool {
323+
sortBySessionID := func(a, b workspaceapps.StatsReport) int {
324324
if a.SessionID == b.SessionID {
325-
if !a.SessionEndedAt.IsZero() && !b.SessionEndedAt.IsZero() {
326-
return a.SessionEndedAt.Before(b.SessionEndedAt)
327-
}
328-
if a.SessionEndedAt.IsZero() {
329-
return true
330-
}
331-
return false
325+
return int(a.SessionEndedAt.Sub(b.SessionEndedAt))
332326
}
333-
return a.SessionID.String() < b.SessionID.String()
327+
if a.SessionID.String() < b.SessionID.String() {
328+
return -1
329+
}
330+
return 1
334331
}
335332
slices.SortFunc(tt.want, sortBySessionID)
336333
slices.SortFunc(gotStats, sortBySessionID)

coderd/workspaceapps_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func TestWorkspaceApps(t *testing.T) {
275275
"CF-Connecting-IP",
276276
},
277277
},
278-
WorkspaceAppsStatsCollector: opts.StatsCollector,
278+
WorkspaceAppsStatsCollectorOptions: opts.StatsCollectorOptions,
279279
})
280280

281281
user := coderdtest.CreateFirstUser(t, client)

enterprise/coderd/workspaceproxy.go

-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,6 @@ func (api *API) workspaceProxyIssueSignedAppToken(rw http.ResponseWriter, r *htt
501501
// @ID report-workspace-app-stats
502502
// @Security CoderSessionToken
503503
// @Accept json
504-
// @Produce json
505504
// @Tags Enterprise
506505
// @Param request body wsproxysdk.ReportAppStatsRequest true "Report app stats request"
507506
// @Success 204

0 commit comments

Comments
 (0)