Skip to content

Commit 841b1a3

Browse files
author
York Chen
committed
feat: init this new recorder in main
1 parent 34aa17e commit 841b1a3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

controllers/suite_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import (
5353
"github.com/fluxcd/source-controller/internal/cache"
5454
"github.com/fluxcd/source-controller/internal/features"
5555
"github.com/fluxcd/source-controller/internal/helm/registry"
56+
"github.com/fluxcd/source-controller/internal/helm/repository"
5657
"github.com/fluxcd/source-controller/pkg/git/libgit2/managed"
5758
// +kubebuilder:scaffold:imports
5859
)
@@ -106,6 +107,7 @@ var (
106107
var (
107108
testRegistryServer *registryClientTestServer
108109
testCache *cache.Cache
110+
testRepoRecorder *repository.Recorder
109111
)
110112

111113
func init() {
@@ -263,6 +265,7 @@ func TestMain(m *testing.M) {
263265

264266
testCache = cache.New(5, 1*time.Second)
265267
cacheRecorder := cache.MustMakeMetrics()
268+
testRepoRecorder = repository.MustMakeMetrics()
266269

267270
if err := (&OCIRepositoryReconciler{
268271
Client: testEnv,
@@ -282,6 +285,7 @@ func TestMain(m *testing.M) {
282285
Cache: testCache,
283286
TTL: 1 * time.Second,
284287
CacheRecorder: cacheRecorder,
288+
RepoRecorder: testRepoRecorder,
285289
}).SetupWithManager(testEnv); err != nil {
286290
panic(fmt.Sprintf("Failed to start HelmRepositoryReconciler: %v", err))
287291
}

main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package main
1818

1919
import (
2020
"fmt"
21+
"github.com/fluxcd/source-controller/internal/helm/repository"
2122
"net"
2223
"net/http"
2324
"os"
@@ -225,6 +226,8 @@ func main() {
225226
os.Exit(1)
226227
}
227228

229+
repoRecorder := repository.MustMakeMetrics()
230+
228231
if err = (&controllers.HelmRepositoryOCIReconciler{
229232
Client: mgr.GetClient(),
230233
EventRecorder: eventRecorder,
@@ -270,6 +273,7 @@ func main() {
270273
Cache: c,
271274
TTL: ttl,
272275
CacheRecorder: cacheRecorder,
276+
RepoRecorder: repoRecorder,
273277
}).SetupWithManagerAndOptions(mgr, controllers.HelmRepositoryReconcilerOptions{
274278
MaxConcurrentReconciles: concurrent,
275279
RateLimiter: helper.GetRateLimiter(rateLimiterOptions),

0 commit comments

Comments
 (0)