Skip to content

Commit 9173e9a

Browse files
CR's fixes
1 parent 6c41e03 commit 9173e9a

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

enterprise/coderd/prebuilds/claim_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package prebuilds_test
33
import (
44
"context"
55
"database/sql"
6+
"slices"
67
"strings"
78
"sync/atomic"
89
"testing"
@@ -125,7 +126,7 @@ func TestClaimPrebuild(t *testing.T) {
125126
t.Parallel()
126127

127128
// Setup.
128-
ctx := testutil.Context(t, testutil.WaitMedium)
129+
ctx := testutil.Context(t, testutil.WaitSuperLong)
129130
db, pubsub := dbtestutil.NewDB(t)
130131
spy := newStoreSpy(db)
131132
expectedPrebuildsCount := desiredInstances * presetCount
@@ -250,13 +251,9 @@ func TestClaimPrebuild(t *testing.T) {
250251
require.Equal(t, expectedPrebuildsCount-1, len(currentPrebuilds))
251252

252253
// 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+
})
260257
require.False(t, found, "claimed prebuild should not still be considered a running prebuild")
261258

262259
// 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) {
407404
t.Parallel()
408405

409406
// Setup.
410-
ctx := testutil.Context(t, testutil.WaitMedium)
407+
ctx := testutil.Context(t, testutil.WaitSuperLong)
411408
db, pubsub := dbtestutil.NewDB(t)
412409
errorStore := newErrorStore(db, tc.claimingErr)
413410

0 commit comments

Comments
 (0)