@@ -13,6 +13,7 @@ import (
13
13
"golang.org/x/sync/errgroup"
14
14
15
15
"github.com/coder/coder/v2/coderd/coderdtest/promhelp"
16
+ "github.com/coder/coder/v2/coderd/database/dbauthz"
16
17
"github.com/coder/coder/v2/coderd/rbac"
17
18
"github.com/coder/coder/v2/coderd/rbac/policy"
18
19
"github.com/coder/coder/v2/testutil"
@@ -28,6 +29,7 @@ func cachePromMetricName(metric string) string {
28
29
29
30
func TestConcurrency (t * testing.T ) {
30
31
t .Parallel ()
32
+ ctx := dbauthz .AsFileReader (t .Context ())
31
33
32
34
const fileSize = 10
33
35
emptyFS := afero .NewIOFS (afero .NewReadOnlyFs (afero .NewMemMapFs ()))
@@ -57,7 +59,7 @@ func TestConcurrency(t *testing.T) {
57
59
g .Go (func ()error {
58
60
// We don't bother to Release these references because the Cache will be
59
61
// released at the end of the test anyway.
60
- _ ,err := c .Acquire (t . Context () ,id )
62
+ _ ,err := c .Acquire (ctx ,id )
61
63
return err
62
64
})
63
65
}
@@ -80,6 +82,7 @@ func TestConcurrency(t *testing.T) {
80
82
81
83
func TestRelease (t * testing.T ) {
82
84
t .Parallel ()
85
+ ctx := dbauthz .AsFileReader (t .Context ())
83
86
84
87
const fileSize = 10
85
88
emptyFS := afero .NewIOFS (afero .NewReadOnlyFs (afero .NewMemMapFs ()))
@@ -101,7 +104,7 @@ func TestRelease(t *testing.T) {
101
104
batchSize := 10
102
105
for openedIdx ,id := range ids {
103
106
for batchIdx := range batchSize {
104
- it ,err := c .Acquire (t . Context () ,id )
107
+ it ,err := c .Acquire (ctx ,id )
105
108
require .NoError (t ,err )
106
109
require .Equal (t ,emptyFS ,it )
107
110