MCPcopy Index your code
hub / github.com/coder/coder / cacheAuthzSetup

Function cacheAuthzSetup

coderd/files/cache_test.go:340–357  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

338}
339
340func cacheAuthzSetup(t *testing.T) (database.Store, *files.Cache, *coderdtest.RecordingAuthorizer) {
341 t.Helper()
342
343 logger := slogtest.Make(t, &slogtest.Options{})
344 reg := prometheus.NewRegistry()
345
346 db, _ := dbtestutil.NewDB(t)
347 authz := rbac.NewAuthorizer(reg)
348 rec := &coderdtest.RecordingAuthorizer{
349 Called: nil,
350 Wrapped: authz,
351 }
352
353 // Dbauthz wrap the db
354 db = dbauthz.New(db, rec, logger, coderdtest.AccessControlStorePointer())
355 c := files.New(reg, rec)
356 return db, c, rec
357}
358
359func must[T any](t T, err error) T {
360 if err != nil {

Callers 1

TestCacheRBACFunction · 0.85

Calls 6

NewDBFunction · 0.92
NewAuthorizerFunction · 0.92
NewFunction · 0.92
NewFunction · 0.92
HelperMethod · 0.65

Tested by

no test coverage detected