@@ -249,32 +249,6 @@ func Test_CheckWebhookSupport(t *testing.T) {
249249 bundle * bundle.RegistryV1
250250 expectedErrs []error
251251 }{
252- {
253- name : "accepts bundles with validating webhook definitions when they only support AllNamespaces install mode" ,
254- bundle : & bundle.RegistryV1 {
255- CSV : MakeCSV (
256- WithInstallModeSupportFor (v1alpha1 .InstallModeTypeAllNamespaces ),
257- WithWebhookDefinitions (
258- v1alpha1.WebhookDescription {
259- Type : v1alpha1 .ValidatingAdmissionWebhook ,
260- },
261- ),
262- ),
263- },
264- },
265- {
266- name : "accepts bundles with mutating webhook definitions when they only support AllNamespaces install mode" ,
267- bundle : & bundle.RegistryV1 {
268- CSV : MakeCSV (
269- WithInstallModeSupportFor (v1alpha1 .InstallModeTypeAllNamespaces ),
270- WithWebhookDefinitions (
271- v1alpha1.WebhookDescription {
272- Type : v1alpha1 .MutatingAdmissionWebhook ,
273- },
274- ),
275- ),
276- },
277- },
278252 {
279253 name : "accepts bundles with conversion webhook definitions when they only support AllNamespaces install mode" ,
280254 bundle : & bundle.RegistryV1 {
@@ -289,7 +263,7 @@ func Test_CheckWebhookSupport(t *testing.T) {
289263 },
290264 },
291265 {
292- name : "rejects bundles with validating webhook definitions when they support more modes than AllNamespaces install mode" ,
266+ name : "accepts bundles with validating webhook definitions when they support more modes than AllNamespaces install mode" ,
293267 bundle : & bundle.RegistryV1 {
294268 CSV : MakeCSV (
295269 WithInstallModeSupportFor (v1alpha1 .InstallModeTypeAllNamespaces , v1alpha1 .InstallModeTypeSingleNamespace ),
@@ -300,7 +274,6 @@ func Test_CheckWebhookSupport(t *testing.T) {
300274 ),
301275 ),
302276 },
303- expectedErrs : []error {errors .New ("bundle contains webhook definitions but supported install modes beyond AllNamespaces" )},
304277 },
305278 {
306279 name : "accepts bundles with mutating webhook definitions when they support more modes than AllNamespaces install mode" ,
@@ -314,10 +287,9 @@ func Test_CheckWebhookSupport(t *testing.T) {
314287 ),
315288 ),
316289 },
317- expectedErrs : []error {errors .New ("bundle contains webhook definitions but supported install modes beyond AllNamespaces" )},
318290 },
319291 {
320- name : "accepts bundles with conversion webhook definitions when they support more modes than AllNamespaces install mode" ,
292+ name : "rejects bundles with conversion webhook definitions when they support more modes than AllNamespaces install mode" ,
321293 bundle : & bundle.RegistryV1 {
322294 CSV : MakeCSV (
323295 WithInstallModeSupportFor (v1alpha1 .InstallModeTypeAllNamespaces , v1alpha1 .InstallModeTypeSingleNamespace ),
@@ -328,11 +300,11 @@ func Test_CheckWebhookSupport(t *testing.T) {
328300 ),
329301 ),
330302 },
331- expectedErrs : []error {errors .New ("bundle contains webhook definitions but supported install modes beyond AllNamespaces" )},
303+ expectedErrs : []error {errors .New ("bundle contains conversion webhooks and supports install modes [AllNamespaces SingleNamespace] - conversion webhooks are only supported for bundles that only support AllNamespaces install mode " )},
332304 },
333305 } {
334306 t .Run (tc .name , func (t * testing.T ) {
335- errs := validators .CheckWebhookSupport (tc .bundle )
307+ errs := validators .CheckConversionWebhookSupport (tc .bundle )
336308 require .Equal (t , tc .expectedErrs , errs )
337309 })
338310 }
0 commit comments