(t *testing.T, log slog.Logger, clock quartz.Clock, intervals metricscache.Intervals, usage bool)
| 29 | } |
| 30 | |
| 31 | func newMetricsCache(t *testing.T, log slog.Logger, clock quartz.Clock, intervals metricscache.Intervals, usage bool) (*metricscache.Cache, database.Store) { |
| 32 | t.Helper() |
| 33 | |
| 34 | accessControlStore := &atomic.Pointer[dbauthz.AccessControlStore]{} |
| 35 | var acs dbauthz.AccessControlStore = dbauthz.AGPLTemplateAccessControlStore{} |
| 36 | accessControlStore.Store(&acs) |
| 37 | |
| 38 | var ( |
| 39 | auth = rbac.NewStrictCachingAuthorizer(prometheus.NewRegistry()) |
| 40 | db, _ = dbtestutil.NewDB(t) |
| 41 | dbauth = dbauthz.New(db, auth, log, accessControlStore) |
| 42 | cache = metricscache.New(dbauth, log, clock, intervals, usage) |
| 43 | ) |
| 44 | |
| 45 | t.Cleanup(func() { cache.Close() }) |
| 46 | |
| 47 | return cache, db |
| 48 | } |
| 49 | |
| 50 | func TestCache_TemplateWorkspaceOwners(t *testing.T) { |
| 51 | t.Parallel() |
no test coverage detected