@@ -28,6 +28,8 @@ import (
2828 "testing"
2929 "time"
3030
31+ "github.com/phayes/freeport"
32+ "github.com/sirupsen/logrus"
3133 "golang.org/x/crypto/bcrypt"
3234 "helm.sh/helm/v3/pkg/getter"
3335 helmreg "helm.sh/helm/v3/pkg/registry"
@@ -36,18 +38,16 @@ import (
3638 "k8s.io/client-go/tools/record"
3739 ctrl "sigs.k8s.io/controller-runtime"
3840
39- dcontext "github.com/distribution/distribution/v3/context"
40- "github.com/fluxcd/pkg/runtime/controller"
41- "github.com/fluxcd/pkg/runtime/testenv"
42- "github.com/fluxcd/pkg/testserver"
43- "github.com/phayes/freeport"
44- "github.com/sirupsen/logrus"
45-
4641 "github.com/distribution/distribution/v3/configuration"
42+ dcontext "github.com/distribution/distribution/v3/context"
4743 dockerRegistry "github.com/distribution/distribution/v3/registry"
4844 _ "github.com/distribution/distribution/v3/registry/auth/htpasswd"
4945 _ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
5046
47+ "github.com/fluxcd/pkg/runtime/controller"
48+ "github.com/fluxcd/pkg/runtime/testenv"
49+ "github.com/fluxcd/pkg/testserver"
50+
5151 sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
5252 "github.com/fluxcd/source-controller/internal/cache"
5353 "github.com/fluxcd/source-controller/internal/features"
@@ -241,7 +241,9 @@ func TestMain(m *testing.M) {
241241 features : map [string ]bool {
242242 features .OptimizedGitClones : true ,
243243 },
244- }).SetupWithManager (testEnv ); err != nil {
244+ }).SetupWithManagerAndOptions (testEnv , GitRepositoryReconcilerOptions {
245+ RateLimiter : controller .GetDefaultRateLimiter (),
246+ }); err != nil {
245247 panic (fmt .Sprintf ("Failed to start GitRepositoryReconciler: %v" , err ))
246248 }
247249
@@ -250,7 +252,9 @@ func TestMain(m *testing.M) {
250252 EventRecorder : record .NewFakeRecorder (32 ),
251253 Metrics : testMetricsH ,
252254 Storage : testStorage ,
253- }).SetupWithManager (testEnv ); err != nil {
255+ }).SetupWithManagerAndOptions (testEnv , BucketReconcilerOptions {
256+ RateLimiter : controller .GetDefaultRateLimiter (),
257+ }); err != nil {
254258 panic (fmt .Sprintf ("Failed to start BucketReconciler: %v" , err ))
255259 }
256260
@@ -262,7 +266,9 @@ func TestMain(m *testing.M) {
262266 EventRecorder : record .NewFakeRecorder (32 ),
263267 Metrics : testMetricsH ,
264268 Storage : testStorage ,
265- }).SetupWithManager (testEnv ); err != nil {
269+ }).SetupWithManagerAndOptions (testEnv , OCIRepositoryReconcilerOptions {
270+ RateLimiter : controller .GetDefaultRateLimiter (),
271+ }); err != nil {
266272 panic (fmt .Sprintf ("Failed to start OCIRepositoryReconciler: %v" , err ))
267273 }
268274
@@ -275,7 +281,9 @@ func TestMain(m *testing.M) {
275281 Cache : testCache ,
276282 TTL : 1 * time .Second ,
277283 CacheRecorder : cacheRecorder ,
278- }).SetupWithManager (testEnv ); err != nil {
284+ }).SetupWithManagerAndOptions (testEnv , HelmRepositoryReconcilerOptions {
285+ RateLimiter : controller .GetDefaultRateLimiter (),
286+ }); err != nil {
279287 panic (fmt .Sprintf ("Failed to start HelmRepositoryReconciler: %v" , err ))
280288 }
281289
@@ -285,7 +293,9 @@ func TestMain(m *testing.M) {
285293 Metrics : testMetricsH ,
286294 Getters : testGetters ,
287295 RegistryClientGenerator : registry .ClientGenerator ,
288- }).SetupWithManager (testEnv ); err != nil {
296+ }).SetupWithManagerAndOptions (testEnv , HelmRepositoryReconcilerOptions {
297+ RateLimiter : controller .GetDefaultRateLimiter (),
298+ }); err != nil {
289299 panic (fmt .Sprintf ("Failed to start HelmRepositoryOCIReconciler: %v" , err ))
290300 }
291301
@@ -298,8 +308,10 @@ func TestMain(m *testing.M) {
298308 Cache : testCache ,
299309 TTL : 1 * time .Second ,
300310 CacheRecorder : cacheRecorder ,
301- }).SetupWithManager (testEnv ); err != nil {
302- panic (fmt .Sprintf ("Failed to start HelmRepositoryReconciler: %v" , err ))
311+ }).SetupWithManagerAndOptions (testEnv , HelmChartReconcilerOptions {
312+ RateLimiter : controller .GetDefaultRateLimiter (),
313+ }); err != nil {
314+ panic (fmt .Sprintf ("Failed to start HelmChartReconciler: %v" , err ))
303315 }
304316
305317 go func () {
0 commit comments