@@ -1515,14 +1515,17 @@ func TestWorkspaceAgentAppHealth(t *testing.T) {
15151515}).Do ()
15161516
15171517res := dbgen .WorkspaceResource (t ,db , database.WorkspaceResource {JobID :r .Build .JobID })
1518- agent := dbgen .WorkspaceAgent (t ,db , database.WorkspaceAgent {ResourceID :res .ID })
1518+ agnt := dbgen .WorkspaceAgent (t ,db , database.WorkspaceAgent {ResourceID :res .ID })
1519+
1520+ //nolint:gocritic // It's a test it's ok.
1521+ asSystemCtx := dbauthz .AsSystemRestricted (t .Context ())
15191522
15201523// It's simpler to call db.InsertWorkspaceApp directly than dbgen.WorkspaceApp because it's more terse and direct;
15211524// the latter sets a bunch of defaults which make this test hard.
1522- _ ,err := db .InsertWorkspaceApp (dbauthz . AsSystemRestricted ( t . Context ()) , database.InsertWorkspaceAppParams {
1525+ _ ,err := db .InsertWorkspaceApp (asSystemCtx , database.InsertWorkspaceAppParams {
15231526ID :uuid .New (),
15241527Slug :"code-server" ,
1525- AgentID :agent .ID ,
1528+ AgentID :agnt .ID ,
15261529Icon :"/code.svg" ,
15271530Command : sql.NullString {String :"some-command" ,Valid :true },
15281531Url : sql.NullString {String :"http://localhost:3000" ,Valid :true },
@@ -1531,11 +1534,11 @@ func TestWorkspaceAgentAppHealth(t *testing.T) {
15311534OpenIn :database .WorkspaceAppOpenInWindow ,
15321535})
15331536require .NoError (t ,err )
1534- _ ,err = db .InsertWorkspaceApp (dbauthz . AsSystemRestricted ( t . Context ()) , database.InsertWorkspaceAppParams {
1537+ _ ,err = db .InsertWorkspaceApp (asSystemCtx , database.InsertWorkspaceAppParams {
15351538ID :uuid .New (),
15361539Slug :"code-server-2" ,
15371540DisplayName :"code-server-2" ,
1538- AgentID :agent .ID ,
1541+ AgentID :agnt .ID ,
15391542Icon :"/code.svg" ,
15401543Command : sql.NullString {String :"some-command" ,Valid :true },
15411544Url : sql.NullString {String :"http://localhost:3000" ,Valid :true },
@@ -1552,7 +1555,7 @@ func TestWorkspaceAgentAppHealth(t *testing.T) {
15521555defer cancel ()
15531556
15541557agentClient := agentsdk .New (client .URL )
1555- agentClient .SetSessionToken (agent .AuthToken .String ())
1558+ agentClient .SetSessionToken (agnt .AuthToken .String ())
15561559conn ,err := agentClient .ConnectRPC (ctx )
15571560require .NoError (t ,err )
15581561defer func () {