@@ -53,46 +53,46 @@ var _ = Describe("controller", func() {
5353 Describe ("controller" , func () {
5454 // TODO(directxman12): write a whole suite of controller-client interaction tests
5555
56- // Since all tests are run in parallel and share the same testenv, we namespace the objects
57- // created by using a namespace per entry, and adding a watch predicate that filters by
58- // namespace.
56+ // Since all tests are run in parallel and share the same testenv, we namespace the objects
57+ // created by using a namespace per entry, and adding a watch predicate that filters by
58+ // namespace.
5959 DescribeTable ("should reconcile" , func (enableWarmup bool ) {
6060 By ("Creating the Manager" )
6161 cm , err := manager .New (cfg , manager.Options {})
6262 Expect (err ).NotTo (HaveOccurred ())
6363
6464 By ("Creating the Controller" )
6565 instance , err := controller .New (
66- fmt .Sprintf ("foo-controller-%t" , enableWarmup ),
67- cm ,
68- controller.Options {
69- Reconciler : reconcile .Func (
70- func (_ context.Context , request reconcile.Request ) (reconcile.Result , error ) {
71- reconciled <- request
72- return reconcile.Result {}, nil
73- }),
74- EnableWarmup : ptr .To (enableWarmup ),
75- },
76- )
66+ fmt .Sprintf ("foo-controller-%t" , enableWarmup ),
67+ cm ,
68+ controller.Options {
69+ Reconciler : reconcile .Func (
70+ func (_ context.Context , request reconcile.Request ) (reconcile.Result , error ) {
71+ reconciled <- request
72+ return reconcile.Result {}, nil
73+ }),
74+ EnableWarmup : ptr .To (enableWarmup ),
75+ },
76+ )
7777 Expect (err ).NotTo (HaveOccurred ())
7878
79- testNamespace := strconv .FormatBool (enableWarmup )
79+ testNamespace := strconv .FormatBool (enableWarmup )
8080
8181 By ("Watching Resources" )
8282 err = instance .Watch (
8383 source .Kind (cm .GetCache (), & appsv1.ReplicaSet {},
8484 handler .TypedEnqueueRequestForOwner [* appsv1.ReplicaSet ](cm .GetScheme (), cm .GetRESTMapper (), & appsv1.Deployment {}),
85- makeNamespacePredicate [* appsv1.ReplicaSet ](testNamespace ),
85+ makeNamespacePredicate [* appsv1.ReplicaSet ](testNamespace ),
8686 ),
8787 )
8888 Expect (err ).NotTo (HaveOccurred ())
8989
9090 err = instance .Watch (
91- source .Kind (cm .GetCache (), & appsv1.Deployment {},
92- & handler.TypedEnqueueRequestForObject [* appsv1.Deployment ]{},
93- makeNamespacePredicate [* appsv1.Deployment ](testNamespace ),
94- ),
95- )
91+ source .Kind (cm .GetCache (), & appsv1.Deployment {},
92+ & handler.TypedEnqueueRequestForObject [* appsv1.Deployment ]{},
93+ makeNamespacePredicate [* appsv1.Deployment ](testNamespace ),
94+ ),
95+ )
9696 Expect (err ).NotTo (HaveOccurred ())
9797
9898 err = cm .GetClient ().Get (ctx , types.NamespacedName {Name : "foo" }, & corev1.Namespace {})
@@ -135,11 +135,11 @@ var _ = Describe("controller", func() {
135135 Name : "deployment-name" ,
136136 }}
137137
138- By ("Creating the test namespace" )
139- _ , err = clientset .CoreV1 ().Namespaces ().Create (ctx , & corev1.Namespace {
140- ObjectMeta : metav1.ObjectMeta { Name : testNamespace },
141- }, metav1.CreateOptions {})
142- Expect (err ).NotTo (HaveOccurred ())
138+ By ("Creating the test namespace" )
139+ _ , err = clientset .CoreV1 ().Namespaces ().Create (ctx , & corev1.Namespace {
140+ ObjectMeta : metav1.ObjectMeta {Name : testNamespace },
141+ }, metav1.CreateOptions {})
142+ Expect (err ).NotTo (HaveOccurred ())
143143
144144 By ("Invoking Reconciling for Create" )
145145 deployment , err = clientset .AppsV1 ().Deployments (testNamespace ).Create (ctx , deployment , metav1.CreateOptions {})
@@ -202,11 +202,11 @@ var _ = Describe("controller", func() {
202202 By ("Invoking Reconciling for a pod when it is created when adding watcher dynamically" )
203203 // Add new watcher dynamically
204204 err = instance .Watch (
205- source .Kind (cm .GetCache (), & corev1.Pod {},
206- & handler.TypedEnqueueRequestForObject [* corev1.Pod ]{},
207- makeNamespacePredicate [* corev1.Pod ](testNamespace ),
208- ),
209- )
205+ source .Kind (cm .GetCache (), & corev1.Pod {},
206+ & handler.TypedEnqueueRequestForObject [* corev1.Pod ]{},
207+ makeNamespacePredicate [* corev1.Pod ](testNamespace ),
208+ ),
209+ )
210210 Expect (err ).NotTo (HaveOccurred ())
211211
212212 pod := & corev1.Pod {
@@ -242,9 +242,9 @@ var _ = Describe("controller", func() {
242242// makeNamespacePredicate returns a predicate that filters out all objects not in the passed in
243243// namespace.
244244func makeNamespacePredicate [object client.Object ](namespace string ) predicate.TypedPredicate [object ] {
245- return predicate.NewTypedPredicateFuncs [object ](func (obj object ) bool {
246- return obj .GetNamespace () == namespace
247- })
245+ return predicate.NewTypedPredicateFuncs [object ](func (obj object ) bool {
246+ return obj .GetNamespace () == namespace
247+ })
248248}
249249
250250func truePtr () * bool {
0 commit comments