mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: wire up usage tracking for managed agents (#19096)
Wires up the usage collector and publisher to coderd. Relates to coder/internal#814
This commit is contained in:
@@ -45,7 +45,6 @@ func TestCancelledFetch(t *testing.T) {
|
||||
cache := files.New(prometheus.NewRegistry(), &coderdtest.FakeAuthorizer{})
|
||||
|
||||
// Cancel the context for the first call; should fail.
|
||||
//nolint:gocritic // Unit testing
|
||||
ctx, cancel := context.WithCancel(dbauthz.AsFileReader(testutil.Context(t, testutil.WaitShort)))
|
||||
cancel()
|
||||
_, err := cache.Acquire(ctx, dbM, fileID)
|
||||
@@ -71,7 +70,6 @@ func TestCancelledConcurrentFetch(t *testing.T) {
|
||||
|
||||
cache := files.LeakCache{Cache: files.New(prometheus.NewRegistry(), &coderdtest.FakeAuthorizer{})}
|
||||
|
||||
//nolint:gocritic // Unit testing
|
||||
ctx := dbauthz.AsFileReader(testutil.Context(t, testutil.WaitShort))
|
||||
|
||||
// Cancel the context for the first call; should fail.
|
||||
@@ -99,7 +97,6 @@ func TestConcurrentFetch(t *testing.T) {
|
||||
})
|
||||
|
||||
cache := files.New(prometheus.NewRegistry(), &coderdtest.FakeAuthorizer{})
|
||||
//nolint:gocritic // Unit testing
|
||||
ctx := dbauthz.AsFileReader(testutil.Context(t, testutil.WaitShort))
|
||||
|
||||
// Expect 2 calls to Acquire before we continue the test
|
||||
@@ -151,7 +148,6 @@ func TestCacheRBAC(t *testing.T) {
|
||||
Scope: rbac.ScopeAll,
|
||||
})
|
||||
|
||||
//nolint:gocritic // Unit testing
|
||||
cacheReader := dbauthz.AsFileReader(ctx)
|
||||
|
||||
t.Run("NoRolesOpen", func(t *testing.T) {
|
||||
@@ -207,7 +203,6 @@ func cachePromMetricName(metric string) string {
|
||||
|
||||
func TestConcurrency(t *testing.T) {
|
||||
t.Parallel()
|
||||
//nolint:gocritic // Unit testing
|
||||
ctx := dbauthz.AsFileReader(t.Context())
|
||||
|
||||
const fileSize = 10
|
||||
@@ -268,7 +263,6 @@ func TestConcurrency(t *testing.T) {
|
||||
|
||||
func TestRelease(t *testing.T) {
|
||||
t.Parallel()
|
||||
//nolint:gocritic // Unit testing
|
||||
ctx := dbauthz.AsFileReader(t.Context())
|
||||
|
||||
const fileSize = 10
|
||||
|
||||
Reference in New Issue
Block a user