Skip to content

fix: return only the first workspace agent script timing per script #16203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: change argument order
  • Loading branch information
DanielleMaywood committed Jan 21, 2025
commit 6a288bfeb9b1724b336811adf5c5e47265cad0a6
2 changes: 1 addition & 1 deletion coderd/database/dbgen/dbgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func WorkspaceAgentScript(t testing.TB, db database.Store, orig database.Workspa
return scripts[0]
}

func WorkspaceAgentScripts(t testing.TB, db database.Store, orig database.WorkspaceAgentScript, count int) []database.WorkspaceAgentScript {
func WorkspaceAgentScripts(t testing.TB, db database.Store, count int, orig database.WorkspaceAgentScript) []database.WorkspaceAgentScript {
scripts := make([]database.WorkspaceAgentScript, 0, count)
for range count {
scripts = append(scripts, WorkspaceAgentScript(t, db, orig))
Expand Down
6 changes: 3 additions & 3 deletions coderd/workspacebuilds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@ func TestWorkspaceBuildTimings(t *testing.T) {
ScriptID: script.ID,
})

// Add an hour to the previous started so we can
// Add an hour to the previous "started at" so we can
// reliably differentiate the scripts from each other.
scriptStartedAt = scriptStartedAt.Add(1 * time.Hour)
}
Expand Down Expand Up @@ -1600,9 +1600,9 @@ func TestWorkspaceBuildTimings(t *testing.T) {
agent := dbgen.WorkspaceAgent(t, db, database.WorkspaceAgent{
ResourceID: resource.ID,
})
scripts := dbgen.WorkspaceAgentScripts(t, db, database.WorkspaceAgentScript{
scripts := dbgen.WorkspaceAgentScripts(t, db, 5, database.WorkspaceAgentScript{
WorkspaceAgentID: agent.ID,
}, 5)
})
agentScriptTimings := dbgen.WorkspaceAgentScriptTimings(t, db, scripts)

// When: fetching timings for the build
Expand Down
4 changes: 2 additions & 2 deletions coderd/workspaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3913,9 +3913,9 @@ func TestWorkspaceTimings(t *testing.T) {
agent := dbgen.WorkspaceAgent(t, db, database.WorkspaceAgent{
ResourceID: resource.ID,
})
scripts := dbgen.WorkspaceAgentScripts(t, db, database.WorkspaceAgentScript{
scripts := dbgen.WorkspaceAgentScripts(t, db, 3, database.WorkspaceAgentScript{
WorkspaceAgentID: agent.ID,
}, 3)
})
dbgen.WorkspaceAgentScriptTimings(t, db, scripts)

// When: fetching the timings
Expand Down
Loading