@@ -3,6 +3,7 @@ package prebuilds_test
3
3
import (
4
4
"context"
5
5
"database/sql"
6
+ "slices"
6
7
"strings"
7
8
"sync/atomic"
8
9
"testing"
@@ -125,7 +126,7 @@ func TestClaimPrebuild(t *testing.T) {
125
126
t .Parallel ()
126
127
127
128
// Setup.
128
- ctx := testutil .Context (t , testutil .WaitMedium )
129
+ ctx := testutil .Context (t , testutil .WaitSuperLong )
129
130
db , pubsub := dbtestutil .NewDB (t )
130
131
spy := newStoreSpy (db )
131
132
expectedPrebuildsCount := desiredInstances * presetCount
@@ -250,13 +251,9 @@ func TestClaimPrebuild(t *testing.T) {
250
251
require .Equal (t , expectedPrebuildsCount - 1 , len (currentPrebuilds ))
251
252
252
253
// Then: the claimed prebuild is now missing from the running prebuilds set.
253
- var found bool
254
- for _ , prebuild := range currentPrebuilds {
255
- if prebuild .ID == claimed .ID {
256
- found = true
257
- break
258
- }
259
- }
254
+ found := slices .ContainsFunc (currentPrebuilds , func (prebuild database.GetRunningPrebuiltWorkspacesRow ) bool {
255
+ return prebuild .ID == claimed .ID
256
+ })
260
257
require .False (t , found , "claimed prebuild should not still be considered a running prebuild" )
261
258
262
259
// Then: reconciling at this point will provision a new prebuild to replace the claimed one.
@@ -407,7 +404,7 @@ func TestClaimPrebuild_CheckDifferentErrors(t *testing.T) {
407
404
t .Parallel ()
408
405
409
406
// Setup.
410
- ctx := testutil .Context (t , testutil .WaitMedium )
407
+ ctx := testutil .Context (t , testutil .WaitSuperLong )
411
408
db , pubsub := dbtestutil .NewDB (t )
412
409
errorStore := newErrorStore (db , tc .claimingErr )
413
410
0 commit comments