Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5cf9b25

Browse files
committed
yeah yeah fine
1 parentcb6ff4a commit5cf9b25

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

‎coderd/files/cache_internal_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ import (
88
"testing"
99
"time"
1010

11-
"github.com/coder/coder/v2/testutil"
1211
"github.com/google/uuid"
12+
"github.com/spf13/afero"
1313
"github.com/stretchr/testify/require"
1414
"golang.org/x/sync/errgroup"
15+
16+
"github.com/coder/coder/v2/testutil"
1517
)
1618

19+
varemptyFS fs.FS=afero.NewIOFS(afero.NewMemMapFs())
20+
1721
funcTestConcurrency(t*testing.T) {
1822
t.Parallel()
1923

@@ -23,7 +27,7 @@ func TestConcurrency(t *testing.T) {
2327
// Wait long enough before returning to make sure that all of the goroutines
2428
// will be waiting in line, ensuring that no one duplicated a fetch.
2529
time.Sleep(testutil.IntervalMedium)
26-
returnnil,nil
30+
returnemptyFS,nil
2731
})
2832

2933
batches:=1000
@@ -56,7 +60,7 @@ func TestRelease(t *testing.T) {
5660
t.Parallel()
5761

5862
c:=newTestCache(func(_ context.Context,_ uuid.UUID) (fs.FS,error) {
59-
returnnil,nil
63+
returnemptyFS,nil
6064
})
6165

6266
batches:=100
@@ -69,7 +73,9 @@ func TestRelease(t *testing.T) {
6973
batchSize:=10
7074
for_,id:=rangeids {
7175
forrangebatchSize {
72-
c.Acquire(t.Context(),id)
76+
fs,err:=c.Acquire(t.Context(),id)
77+
require.NoError(t,err)
78+
require.Equal(t,emptyFS,fs)
7379
}
7480
}
7581

‎coderd/util/lazy/valuewitherror_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ package lazy_test
33
import (
44
"testing"
55

6-
"github.com/coder/coder/v2/coderd/util/lazy"
76
"github.com/stretchr/testify/require"
87
"golang.org/x/xerrors"
8+
9+
"github.com/coder/coder/v2/coderd/util/lazy"
910
)
1011

1112
funcTestLazyWithErrorOK(t*testing.T) {
13+
t.Parallel()
14+
1215
l:=lazy.NewWithError(func() (int,error) {
1316
return1,nil
1417
})
@@ -19,6 +22,8 @@ func TestLazyWithErrorOK(t *testing.T) {
1922
}
2023

2124
funcTestLazyWithErrorErr(t*testing.T) {
25+
t.Parallel()
26+
2227
l:=lazy.NewWithError(func() (int,error) {
2328
return0,xerrors.New("oh no! everything that could went horribly wrong!")
2429
})
@@ -29,6 +34,8 @@ func TestLazyWithErrorErr(t *testing.T) {
2934
}
3035

3136
funcTestLazyWithErrorPointers(t*testing.T) {
37+
t.Parallel()
38+
3239
a:=1
3340
l:=lazy.NewWithError(func() (*int,error) {
3441
return&a,nil

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp