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
It("should deny create CRP with invalid GVK", func() {
@@ -157,7 +156,7 @@ var _ = Describe("webhook tests for CRP CREATE operations", func() {
157
156
g.Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Create CRP call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{})))
158
157
g.Expect(statusErr.ErrStatus.Message).Should(MatchRegexp(regexp.QuoteMeta("failed to get GVR of the selector")))
It("should deny create CRP with namespaced resource selected", func() {
@@ -187,7 +186,7 @@ var _ = Describe("webhook tests for CRP CREATE operations", func() {
187
186
g.Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Create CRP call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{})))
188
187
g.Expect(statusErr.ErrStatus.Message).Should(MatchRegexp(regexp.QuoteMeta("the resource is not found in schema (please retry) or it is not a cluster scoped resource")))
@@ -228,7 +227,7 @@ var _ = Describe("webhook tests for CRP CREATE operations", func() {
228
227
g.Expect(hubClient.Get(ctx, types.NamespacedName{Name: crpName}, &createdCRP)).Should(Succeed(), "Failed to get CRP %s", crpName)
229
228
g.Expect(createdCRP.Spec.Policy).To(Equal(&placementv1beta1.PlacementPolicy{PlacementType: placementv1beta1.PickAllPlacementType}), "CRP should have default policy type PickAll")
It("should allow create CRP with nil revision history limit and update fields with default values", func() {
@@ -358,7 +357,7 @@ var _ = Describe("webhook tests for CRP CREATE operations", func() {
358
357
g.Expect(hubClient.Get(ctx, types.NamespacedName{Name: crpName}, &createdCRP)).Should(Succeed(), "Failed to get CRP %s", crpName)
359
358
g.Expect(*createdCRP.Spec.RevisionHistoryLimit).To(Equal(int32(defaulter.DefaultRevisionHistoryLimitValue)), "CRP should have default revision history limit value")
@@ -441,7 +440,7 @@ var _ = Describe("webhook tests for CRP UPDATE operations", Ordered, func() {
441
440
g.Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update CRP call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{})))
442
441
g.Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("the labelSelector and name fields are mutually exclusive"))
It("should deny update on CRP with invalid placement policy for PickAll", func() {
@@ -483,7 +482,7 @@ var _ = Describe("webhook tests for CRP UPDATE operations", Ordered, func() {
483
482
g.Expect(statusErr.ErrStatus.Message).Should(MatchRegexp(regexp.QuoteMeta(fmt.Sprintf("the labelSelector in cluster selector %+v is invalid:", crp.Spec.Policy.Affinity.ClusterAffinity.RequiredDuringSchedulingIgnoredDuringExecution.ClusterSelectorTerms[0].LabelSelector))))
484
483
g.Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("topology spread constraints needs to be empty for policy type PickAll"))
It("should deny update on CRP with placement policy type update", func() {
@@ -503,7 +502,7 @@ var _ = Describe("webhook tests for CRP UPDATE operations", Ordered, func() {
503
502
g.Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update CRP call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{})))
504
503
g.Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("placement type is immutable"))
@@ -541,7 +540,7 @@ var _ = Describe("webhook tests for CRP UPDATE operations", Ordered, func() {
541
540
g.Expect(hubClient.Get(ctx, types.NamespacedName{Name: crpName}, &updatedCRP)).Should(Succeed(), "Failed to get CRP %s", crpName)
542
541
g.Expect(updatedCRP.Spec.Policy).To(Equal(&placementv1beta1.PlacementPolicy{PlacementType: placementv1beta1.PickAllPlacementType}), "CRP should have default policy type PickAll")
It("should allow update CRP with nil revision history limit and update fields with default values", func() {
@@ -582,7 +581,7 @@ var _ = Describe("webhook tests for CRP UPDATE operations", Ordered, func() {
582
581
g.Expect(hubClient.Get(ctx, types.NamespacedName{Name: crpName}, &updatedCRP)).Should(Succeed(), "Failed to get CRP %s", crpName)
583
582
g.Expect(*createdCRP.Spec.RevisionHistoryLimit).To(Equal(int32(defaulter.DefaultRevisionHistoryLimitValue)), "CRP should have default revision history limit value")
@@ -731,7 +730,7 @@ var _ = Describe("webhook tests for CRP tolerations", Ordered, func() {
731
730
g.Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update CRP call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{})))
732
731
g.Expect(statusErr.ErrStatus.Message).Should(MatchRegexp(fmt.Sprintf("invalid toleration %+v: %s", invalidToleration, "toleration key cannot be empty, when operator is Equal")))
It("should deny update on CRP with update to existing toleration", func() {
@@ -760,7 +759,7 @@ var _ = Describe("webhook tests for CRP tolerations", Ordered, func() {
760
759
g.Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update CRP call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{})))
761
760
g.Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("tolerations have been updated/deleted, only additions to tolerations are allowed"))
@@ -808,7 +807,7 @@ var _ = Describe("webhook tests for MC taints", Ordered, func() {
808
807
g.Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update MC call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{})))
809
808
g.Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character"))
@@ -1169,7 +1168,7 @@ var _ = Describe("webhook tests for CRO UPDATE operations", Ordered, func() {
1169
1168
Expect(statusErr.Status().Message).Should(MatchRegexp(fmt.Sprintf("resource selector %+v already exists, and must be unique", cro.Spec.ClusterResourceSelectors[0])))
1170
1169
Expect(statusErr.Status().Message).Should(MatchRegexp(regexp.QuoteMeta(fmt.Sprintf("resource name is required for resource selection %+v", invalidSelector1))))
@@ -1591,7 +1590,7 @@ var _ = Describe("webhook tests for ResourceOverride UPDATE operations", Ordered
1591
1590
Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update RO call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{})))
1592
1591
Expect(statusErr.Status().Message).Should(MatchRegexp(fmt.Sprintf("resource selector %+v already exists, and must be unique", selector)))
0 commit comments