Skip to content

Commit 233016a

Browse files
committed
update tests
1 parent b79c3a7 commit 233016a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

internal/webhook/v3/wfs_webhook_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,23 @@ var _ = Describe("WFS Webhook", func() {
220220
Expect(warnings).To(BeEmpty())
221221
})
222222

223+
It("Should deny update url was changed but not added to ingressRouteURLs", func() {
224+
url, err := smoothoperatormodel.ParseURL("http://old/changed")
225+
Expect(err).ToNot(HaveOccurred())
226+
oldObj.Spec.IngressRouteURLs = nil
227+
obj.Spec.IngressRouteURLs = []smoothoperatormodel.IngressRouteURL{{URL: oldObj.Spec.Service.URL}}
228+
obj.Spec.Service.URL = smoothoperatormodel.URL{URL: url}
229+
warnings, err := validator.ValidateUpdate(ctx, oldObj, obj)
230+
Expect(err).To(HaveOccurred())
231+
Expect(warnings).To(BeEmpty())
232+
233+
obj.Spec.IngressRouteURLs = []smoothoperatormodel.IngressRouteURL{{URL: smoothoperatormodel.URL{URL: url}}}
234+
warnings, err = validator.ValidateUpdate(ctx, oldObj, obj)
235+
Expect(err).To(HaveOccurred())
236+
Expect(warnings).To(BeEmpty())
237+
238+
})
239+
223240
It("Should deny update if a label was removed", func() {
224241
for label := range obj.Labels {
225242
delete(obj.Labels, label)

0 commit comments

Comments
 (0)