Merge pull request #465 from fluxcd/test-reconciler-ratelimiter
Set rate limiter option in test reconcilers
This commit is contained in:
commit
824b25d453
|
@ -26,9 +26,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/fluxcd/pkg/runtime/controller"
|
||||
"github.com/fluxcd/pkg/runtime/testenv"
|
||||
"github.com/fluxcd/pkg/ssa"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
@ -39,6 +36,10 @@ import (
|
|||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
|
||||
|
||||
"github.com/fluxcd/pkg/runtime/controller"
|
||||
"github.com/fluxcd/pkg/runtime/testenv"
|
||||
"github.com/fluxcd/pkg/ssa"
|
||||
|
||||
apiv1 "github.com/fluxcd/notification-controller/api/v1beta2"
|
||||
// +kubebuilder:scaffold:imports
|
||||
)
|
||||
|
@ -53,7 +54,6 @@ var (
|
|||
func TestMain(m *testing.M) {
|
||||
var err error
|
||||
utilruntime.Must(apiv1.AddToScheme(scheme.Scheme))
|
||||
//utilruntime.Must(sourcev1.AddToScheme(scheme.Scheme))
|
||||
|
||||
testEnv = testenv.New(testenv.WithCRDPath(
|
||||
filepath.Join("..", "config", "crd", "bases"),
|
||||
|
@ -72,7 +72,9 @@ func TestMain(m *testing.M) {
|
|||
Metrics: testMetricsH,
|
||||
ControllerName: controllerName,
|
||||
EventRecorder: testEnv.GetEventRecorderFor(controllerName),
|
||||
}).SetupWithManager(testEnv); err != nil {
|
||||
}).SetupWithManagerAndOptions(testEnv, AlertReconcilerOptions{
|
||||
RateLimiter: controller.GetDefaultRateLimiter(),
|
||||
}); err != nil {
|
||||
panic(fmt.Sprintf("Failed to start AlerReconciler: %v", err))
|
||||
}
|
||||
|
||||
|
@ -81,7 +83,9 @@ func TestMain(m *testing.M) {
|
|||
Metrics: testMetricsH,
|
||||
ControllerName: controllerName,
|
||||
EventRecorder: testEnv.GetEventRecorderFor(controllerName),
|
||||
}).SetupWithManager(testEnv); err != nil {
|
||||
}).SetupWithManagerAndOptions(testEnv, ProviderReconcilerOptions{
|
||||
RateLimiter: controller.GetDefaultRateLimiter(),
|
||||
}); err != nil {
|
||||
panic(fmt.Sprintf("Failed to start ProviderReconciler: %v", err))
|
||||
}
|
||||
|
||||
|
@ -90,7 +94,9 @@ func TestMain(m *testing.M) {
|
|||
Metrics: testMetricsH,
|
||||
ControllerName: controllerName,
|
||||
EventRecorder: testEnv.GetEventRecorderFor(controllerName),
|
||||
}).SetupWithManager(testEnv); err != nil {
|
||||
}).SetupWithManagerAndOptions(testEnv, ReceiverReconcilerOptions{
|
||||
RateLimiter: controller.GetDefaultRateLimiter(),
|
||||
}); err != nil {
|
||||
panic(fmt.Sprintf("Failed to start ReceiverReconciler: %v", err))
|
||||
}
|
||||
|
||||
|
|
2
go.mod
2
go.mod
|
@ -14,7 +14,7 @@ require (
|
|||
github.com/fluxcd/pkg/apis/event v0.2.0
|
||||
github.com/fluxcd/pkg/apis/meta v0.18.0
|
||||
github.com/fluxcd/pkg/masktoken v0.2.0
|
||||
github.com/fluxcd/pkg/runtime v0.24.0
|
||||
github.com/fluxcd/pkg/runtime v0.26.0
|
||||
github.com/fluxcd/pkg/ssa v0.22.0
|
||||
github.com/getsentry/sentry-go v0.15.0
|
||||
github.com/go-logr/logr v1.2.3
|
||||
|
|
4
go.sum
4
go.sum
|
@ -188,8 +188,8 @@ github.com/fluxcd/pkg/apis/meta v0.18.0 h1:s0LeulWcQ4DxVX6805vgDTxlA6bAYk+Lq1QHS
|
|||
github.com/fluxcd/pkg/apis/meta v0.18.0/go.mod h1:pYvXRFi1UKNNrGR34jw3uqOnMXw9X6dTkML8j5Z7tis=
|
||||
github.com/fluxcd/pkg/masktoken v0.2.0 h1:HoSPTk4l1fz5Fevs2vVRvZGru33blfMwWSZKsHdfG/0=
|
||||
github.com/fluxcd/pkg/masktoken v0.2.0/go.mod h1:EA7GleAHL33kN6kTW06m5R3/Q26IyuGO7Ef/0CtpDI0=
|
||||
github.com/fluxcd/pkg/runtime v0.24.0 h1:rQmm5Xq8K7f8xcPj1oNOInM1x4YwmgTucZJOP51Xmr4=
|
||||
github.com/fluxcd/pkg/runtime v0.24.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/ssa v0.22.0 h1:HvJTuiYLZMxCjin7bAqBgnc2RjSqEfYrMbV5yINoM64=
|
||||
github.com/fluxcd/pkg/ssa v0.22.0/go.mod h1:QND0ZNOQ5EzFxoNKfjUxE9J46AbRK3WKF8YkURwbVg0=
|
||||
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
||||
|
|
Loading…
Reference in New Issue