From 0eaf1fb7ec49a8866b9218006c4bc62c429d984a Mon Sep 17 00:00:00 2001 From: Friedrich Wilken Date: Wed, 3 Jan 2024 16:26:41 +0100 Subject: [PATCH] fix unit test --- internal/controller/cache/cache.go | 4 ++-- internal/controller/cache/cache_test.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/controller/cache/cache.go b/internal/controller/cache/cache.go index 80add700..bfb86970 100644 --- a/internal/controller/cache/cache.go +++ b/internal/controller/cache/cache.go @@ -25,12 +25,12 @@ func applySelectors(options cache.Options) cache.Options { // Apply the label selector to all relevant objects. options.ByObject = map[client.Object]cache.ByObject{ - &appsv1.Deployment{}: managedByNATS, &autoscalingv1.HorizontalPodAutoscaler{}: managedByNATS, + &appsv1.Deployment{}: managedByNATS, &corev1.ServiceAccount{}: managedByNATS, + &policyv1.PodDisruptionBudget{}: managedByNATS, &rbacv1.ClusterRole{}: managedByNATS, &rbacv1.ClusterRoleBinding{}: managedByNATS, - &policyv1.PodDisruptionBudget{}: managedByNATS, } return options } diff --git a/internal/controller/cache/cache_test.go b/internal/controller/cache/cache_test.go index f3a6db58..cb7bf008 100644 --- a/internal/controller/cache/cache_test.go +++ b/internal/controller/cache/cache_test.go @@ -11,6 +11,7 @@ import ( appsv1 "k8s.io/api/apps/v1" autoscalingv1 "k8s.io/api/autoscaling/v1" corev1 "k8s.io/api/core/v1" + policyv1 "k8s.io/api/policy/v1" rbacv1 "k8s.io/api/rbac/v1" "k8s.io/apimachinery/pkg/labels" "sigs.k8s.io/controller-runtime/pkg/cache" @@ -48,6 +49,7 @@ func Test_applySelectors(t *testing.T) { &rbacv1.ClusterRole{}: selector, &rbacv1.ClusterRoleBinding{}: selector, &autoscalingv1.HorizontalPodAutoscaler{}: selector, + &policyv1.PodDisruptionBudget{}: selector, }, }, }, @@ -66,6 +68,7 @@ func Test_applySelectors(t *testing.T) { &rbacv1.ClusterRole{}: selector, &rbacv1.ClusterRoleBinding{}: selector, &autoscalingv1.HorizontalPodAutoscaler{}: selector, + &policyv1.PodDisruptionBudget{}: selector, }, }, },