You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expect(err).To(MatchError(ContainSubstring("one of For() or Named() must be called")))
124
+
Expect(instance).To(BeNil())
125
+
})
126
+
127
+
It("should return an error when using Owns without For", func() {
128
+
By("creating a controller manager")
129
+
m, err:=manager.New(cfg, manager.Options{})
130
+
Expect(err).NotTo(HaveOccurred())
131
+
132
+
instance, err:=ControllerManagedBy(m).
133
+
Named("my_controller").
121
134
Owns(&appsv1.ReplicaSet{}).
122
135
Build(noop)
123
-
Expect(err).To(MatchError(ContainSubstring("must provide an object for reconciliation")))
136
+
Expect(err).To(MatchError(ContainSubstring("Owns() can only be used together with For()")))
124
137
Expect(instance).To(BeNil())
138
+
139
+
})
140
+
141
+
It("should return an error when there are no watches", func() {
142
+
By("creating a controller manager")
143
+
m, err:=manager.New(cfg, manager.Options{})
144
+
Expect(err).NotTo(HaveOccurred())
145
+
146
+
instance, err:=ControllerManagedBy(m).
147
+
Named("my_controller").
148
+
Build(noop)
149
+
Expect(err).To(MatchError(ContainSubstring("there are no watches configured, controller will never get triggered. Use For(), Owns() or Watches() to set them up")))
150
+
Expect(instance).To(BeNil())
151
+
})
152
+
153
+
It("should allow creating a controllerw without calling For", func() {
0 commit comments