@@ -175,7 +175,9 @@ func TestClaimPrebuild(t *testing.T) {
175
175
runningPrebuilds := make (map [uuid.UUID ]database.GetRunningPrebuiltWorkspacesRow ,desiredInstances * presetCount )
176
176
require .Eventually (t ,func ()bool {
177
177
rows ,err := spy .GetRunningPrebuiltWorkspaces (ctx )
178
- require .NoError (t ,err )
178
+ if err != nil {
179
+ return false
180
+ }
179
181
180
182
for _ ,row := range rows {
181
183
runningPrebuilds [row .CurrentPresetID .UUID ]= row
@@ -185,16 +187,21 @@ func TestClaimPrebuild(t *testing.T) {
185
187
}
186
188
187
189
agents ,err := db .GetWorkspaceAgentsInLatestBuildByWorkspaceID (ctx ,row .ID )
188
- require .NoError (t ,err )
190
+ if err != nil {
191
+ return false
192
+ }
189
193
190
194
// Workspaces are eligible once its agent is marked "ready".
191
195
for _ ,agent := range agents {
192
- require . NoError ( t , db .UpdateWorkspaceAgentLifecycleStateByID (ctx , database.UpdateWorkspaceAgentLifecycleStateByIDParams {
196
+ err = db .UpdateWorkspaceAgentLifecycleStateByID (ctx , database.UpdateWorkspaceAgentLifecycleStateByIDParams {
193
197
ID :agent .ID ,
194
198
LifecycleState :database .WorkspaceAgentLifecycleStateReady ,
195
199
StartedAt : sql.NullTime {Time :time .Now ().Add (time .Hour ),Valid :true },
196
200
ReadyAt : sql.NullTime {Time :time .Now ().Add (- 1 * time .Hour ),Valid :true },
197
- }))
201
+ })
202
+ if err != nil {
203
+ return false
204
+ }
198
205
}
199
206
}
200
207
@@ -270,7 +277,9 @@ func TestClaimPrebuild(t *testing.T) {
270
277
271
278
require .Eventually (t ,func ()bool {
272
279
rows ,err := spy .GetRunningPrebuiltWorkspaces (ctx )
273
- require .NoError (t ,err )
280
+ if err != nil {
281
+ return false
282
+ }
274
283
275
284
t .Logf ("found %d running prebuilds so far, want %d" ,len (rows ),expectedPrebuildsCount )
276
285
@@ -447,22 +456,29 @@ func TestClaimPrebuild_CheckDifferentErrors(t *testing.T) {
447
456
runningPrebuilds := make (map [uuid.UUID ]database.GetRunningPrebuiltWorkspacesRow ,desiredInstances * presetCount )
448
457
require .Eventually (t ,func ()bool {
449
458
rows ,err := errorStore .GetRunningPrebuiltWorkspaces (ctx )
450
- require .NoError (t ,err )
459
+ if err != nil {
460
+ return false
461
+ }
451
462
452
463
for _ ,row := range rows {
453
464
runningPrebuilds [row .CurrentPresetID .UUID ]= row
454
465
455
466
agents ,err := db .GetWorkspaceAgentsInLatestBuildByWorkspaceID (ctx ,row .ID )
456
- require .NoError (t ,err )
467
+ if err != nil {
468
+ return false
469
+ }
457
470
458
471
// Workspaces are eligible once its agent is marked "ready".
459
472
for _ ,agent := range agents {
460
- require . NoError ( t , db .UpdateWorkspaceAgentLifecycleStateByID (ctx , database.UpdateWorkspaceAgentLifecycleStateByIDParams {
473
+ err = db .UpdateWorkspaceAgentLifecycleStateByID (ctx , database.UpdateWorkspaceAgentLifecycleStateByIDParams {
461
474
ID :agent .ID ,
462
475
LifecycleState :database .WorkspaceAgentLifecycleStateReady ,
463
476
StartedAt : sql.NullTime {Time :time .Now ().Add (time .Hour ),Valid :true },
464
477
ReadyAt : sql.NullTime {Time :time .Now ().Add (- 1 * time .Hour ),Valid :true },
465
- }))
478
+ })
479
+ if err != nil {
480
+ return false
481
+ }
466
482
}
467
483
}
468
484