Set rate limiter option in test reconcilers
Set the default rate limiter configuration used in main.go in the test reconcilers as well. Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
parent
c2e605a5e2
commit
e0cf840d02
|
@ -59,7 +59,9 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/manager"
|
||||
|
||||
"github.com/fluxcd/pkg/gittestserver"
|
||||
"github.com/fluxcd/pkg/runtime/controller"
|
||||
"github.com/fluxcd/pkg/runtime/testenv"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
)
|
||||
|
||||
|
@ -448,7 +450,9 @@ func ensureDependencies() error {
|
|||
utilruntime.Must((&GitRepositoryReconciler{
|
||||
Client: m.GetClient(),
|
||||
Storage: storage,
|
||||
}).SetupWithManager(m))
|
||||
}).SetupWithManagerAndOptions(m, GitRepositoryReconcilerOptions{
|
||||
RateLimiter: controller.GetDefaultRateLimiter(),
|
||||
}))
|
||||
})
|
||||
|
||||
return nil
|
||||
|
|
|
@ -28,6 +28,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/phayes/freeport"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"helm.sh/helm/v3/pkg/getter"
|
||||
helmreg "helm.sh/helm/v3/pkg/registry"
|
||||
|
@ -36,18 +38,16 @@ import (
|
|||
"k8s.io/client-go/tools/record"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
|
||||
dcontext "github.com/distribution/distribution/v3/context"
|
||||
"github.com/fluxcd/pkg/runtime/controller"
|
||||
"github.com/fluxcd/pkg/runtime/testenv"
|
||||
"github.com/fluxcd/pkg/testserver"
|
||||
"github.com/phayes/freeport"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/distribution/distribution/v3/configuration"
|
||||
dcontext "github.com/distribution/distribution/v3/context"
|
||||
dockerRegistry "github.com/distribution/distribution/v3/registry"
|
||||
_ "github.com/distribution/distribution/v3/registry/auth/htpasswd"
|
||||
_ "github.com/distribution/distribution/v3/registry/storage/driver/inmemory"
|
||||
|
||||
"github.com/fluxcd/pkg/runtime/controller"
|
||||
"github.com/fluxcd/pkg/runtime/testenv"
|
||||
"github.com/fluxcd/pkg/testserver"
|
||||
|
||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta2"
|
||||
"github.com/fluxcd/source-controller/internal/cache"
|
||||
"github.com/fluxcd/source-controller/internal/features"
|
||||
|
@ -241,7 +241,9 @@ func TestMain(m *testing.M) {
|
|||
features: map[string]bool{
|
||||
features.OptimizedGitClones: true,
|
||||
},
|
||||
}).SetupWithManager(testEnv); err != nil {
|
||||
}).SetupWithManagerAndOptions(testEnv, GitRepositoryReconcilerOptions{
|
||||
RateLimiter: controller.GetDefaultRateLimiter(),
|
||||
}); err != nil {
|
||||
panic(fmt.Sprintf("Failed to start GitRepositoryReconciler: %v", err))
|
||||
}
|
||||
|
||||
|
@ -250,7 +252,9 @@ func TestMain(m *testing.M) {
|
|||
EventRecorder: record.NewFakeRecorder(32),
|
||||
Metrics: testMetricsH,
|
||||
Storage: testStorage,
|
||||
}).SetupWithManager(testEnv); err != nil {
|
||||
}).SetupWithManagerAndOptions(testEnv, BucketReconcilerOptions{
|
||||
RateLimiter: controller.GetDefaultRateLimiter(),
|
||||
}); err != nil {
|
||||
panic(fmt.Sprintf("Failed to start BucketReconciler: %v", err))
|
||||
}
|
||||
|
||||
|
@ -262,7 +266,9 @@ func TestMain(m *testing.M) {
|
|||
EventRecorder: record.NewFakeRecorder(32),
|
||||
Metrics: testMetricsH,
|
||||
Storage: testStorage,
|
||||
}).SetupWithManager(testEnv); err != nil {
|
||||
}).SetupWithManagerAndOptions(testEnv, OCIRepositoryReconcilerOptions{
|
||||
RateLimiter: controller.GetDefaultRateLimiter(),
|
||||
}); err != nil {
|
||||
panic(fmt.Sprintf("Failed to start OCIRepositoryReconciler: %v", err))
|
||||
}
|
||||
|
||||
|
@ -275,7 +281,9 @@ func TestMain(m *testing.M) {
|
|||
Cache: testCache,
|
||||
TTL: 1 * time.Second,
|
||||
CacheRecorder: cacheRecorder,
|
||||
}).SetupWithManager(testEnv); err != nil {
|
||||
}).SetupWithManagerAndOptions(testEnv, HelmRepositoryReconcilerOptions{
|
||||
RateLimiter: controller.GetDefaultRateLimiter(),
|
||||
}); err != nil {
|
||||
panic(fmt.Sprintf("Failed to start HelmRepositoryReconciler: %v", err))
|
||||
}
|
||||
|
||||
|
@ -285,7 +293,9 @@ func TestMain(m *testing.M) {
|
|||
Metrics: testMetricsH,
|
||||
Getters: testGetters,
|
||||
RegistryClientGenerator: registry.ClientGenerator,
|
||||
}).SetupWithManager(testEnv); err != nil {
|
||||
}).SetupWithManagerAndOptions(testEnv, HelmRepositoryReconcilerOptions{
|
||||
RateLimiter: controller.GetDefaultRateLimiter(),
|
||||
}); err != nil {
|
||||
panic(fmt.Sprintf("Failed to start HelmRepositoryOCIReconciler: %v", err))
|
||||
}
|
||||
|
||||
|
@ -298,8 +308,10 @@ func TestMain(m *testing.M) {
|
|||
Cache: testCache,
|
||||
TTL: 1 * time.Second,
|
||||
CacheRecorder: cacheRecorder,
|
||||
}).SetupWithManager(testEnv); err != nil {
|
||||
panic(fmt.Sprintf("Failed to start HelmRepositoryReconciler: %v", err))
|
||||
}).SetupWithManagerAndOptions(testEnv, HelmChartReconcilerOptions{
|
||||
RateLimiter: controller.GetDefaultRateLimiter(),
|
||||
}); err != nil {
|
||||
panic(fmt.Sprintf("Failed to start HelmChartReconciler: %v", err))
|
||||
}
|
||||
|
||||
go func() {
|
||||
|
|
2
go.mod
2
go.mod
|
@ -31,7 +31,7 @@ require (
|
|||
github.com/fluxcd/pkg/lockedfile v0.1.0
|
||||
github.com/fluxcd/pkg/masktoken v0.2.0
|
||||
github.com/fluxcd/pkg/oci v0.17.0
|
||||
github.com/fluxcd/pkg/runtime v0.25.0
|
||||
github.com/fluxcd/pkg/runtime v0.26.0
|
||||
github.com/fluxcd/pkg/sourceignore v0.3.0
|
||||
github.com/fluxcd/pkg/ssh v0.7.0
|
||||
github.com/fluxcd/pkg/testserver v0.4.0
|
||||
|
|
4
go.sum
4
go.sum
|
@ -549,8 +549,8 @@ github.com/fluxcd/pkg/masktoken v0.2.0 h1:HoSPTk4l1fz5Fevs2vVRvZGru33blfMwWSZKsH
|
|||
github.com/fluxcd/pkg/masktoken v0.2.0/go.mod h1:EA7GleAHL33kN6kTW06m5R3/Q26IyuGO7Ef/0CtpDI0=
|
||||
github.com/fluxcd/pkg/oci v0.17.0 h1:DYoT0HG3DogEmeXRif6ZzTYwAZe+iqYWP4QpsP37ZBE=
|
||||
github.com/fluxcd/pkg/oci v0.17.0/go.mod h1:UjxCQcdcKtog/ad9Vr2yPYjz9keNSoLdTOOiUNqCRiY=
|
||||
github.com/fluxcd/pkg/runtime v0.25.0 h1:Lk5WrKDJKsayymLnnSCY/Zn77/mrlIf+skYz64suoww=
|
||||
github.com/fluxcd/pkg/runtime v0.25.0/go.mod h1:I2T+HWVNzX0cxm9TgH+SVNHTwqlmEDiSke43JXsq9iY=
|
||||
github.com/fluxcd/pkg/runtime v0.26.0 h1:j78f52xzpbR8xOvvemGwbGt4BLxpn9FOzim5tngOYvo=
|
||||
github.com/fluxcd/pkg/runtime v0.26.0/go.mod h1:I2T+HWVNzX0cxm9TgH+SVNHTwqlmEDiSke43JXsq9iY=
|
||||
github.com/fluxcd/pkg/sourceignore v0.3.0 h1:pFO3hKV9ub+2SrNZPZE7xfiRhxsycRrd7JK7qB26nVw=
|
||||
github.com/fluxcd/pkg/sourceignore v0.3.0/go.mod h1:ak3Tve/KwVzytZ5V2yBlGGpTJ/2oQ9kcP3iuwBOAHGo=
|
||||
github.com/fluxcd/pkg/ssh v0.7.0 h1:FX5ky8SU9dYwbM6zEIDR3TSveLF01iyS95CtB5Ykpno=
|
||||
|
|
Loading…
Reference in New Issue