mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
fix: return only the first workspace agent script timing per script (#16203)
Fixes https://github.com/coder/coder/issues/16124 If a workspace agent crashes, it is possible for any startup scripts to be ran again. This PR makes it so that the `GetWorkspaceAgentScriptTimingsByBuildID` query only returns the first timing recorded per-script.
This commit is contained in:
@ -3913,10 +3913,10 @@ func TestWorkspaceTimings(t *testing.T) {
|
||||
agent := dbgen.WorkspaceAgent(t, db, database.WorkspaceAgent{
|
||||
ResourceID: resource.ID,
|
||||
})
|
||||
script := dbgen.WorkspaceAgentScript(t, db, database.WorkspaceAgentScript{
|
||||
scripts := dbgen.WorkspaceAgentScripts(t, db, 3, database.WorkspaceAgentScript{
|
||||
WorkspaceAgentID: agent.ID,
|
||||
})
|
||||
dbgen.WorkspaceAgentScriptTimings(t, db, script, 3)
|
||||
dbgen.WorkspaceAgentScriptTimings(t, db, scripts)
|
||||
|
||||
// When: fetching the timings
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
|
||||
|
Reference in New Issue
Block a user