mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
fix(coderd): workspaceapps: update last_used_at when workspace app reports stats (#11603)
- Adds a new query BatchUpdateLastUsedAt - Adds calls to BatchUpdateLastUsedAt in app stats handler upon flush - Passes a stats flush channel to apptest setup scaffolding and updates unit tests to assert modifications to LastUsedAt.
This commit is contained in:
@ -262,6 +262,13 @@ func TestWorkspaceApps(t *testing.T) {
|
||||
opts.AppHost = ""
|
||||
}
|
||||
|
||||
flushStatsCollectorCh := make(chan chan<- struct{}, 1)
|
||||
opts.StatsCollectorOptions.Flush = flushStatsCollectorCh
|
||||
flushStats := func() {
|
||||
flushStatsCollectorDone := make(chan struct{}, 1)
|
||||
flushStatsCollectorCh <- flushStatsCollectorDone
|
||||
<-flushStatsCollectorDone
|
||||
}
|
||||
client := coderdtest.New(t, &coderdtest.Options{
|
||||
DeploymentValues: deploymentValues,
|
||||
AppHostname: opts.AppHost,
|
||||
@ -285,6 +292,7 @@ func TestWorkspaceApps(t *testing.T) {
|
||||
SDKClient: client,
|
||||
FirstUser: user,
|
||||
PathAppBaseURL: client.URL,
|
||||
FlushStats: flushStats,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user