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
Copy file name to clipboardExpand all lines: test/apis/placement/v1beta1/api_validation_integration_test.go
+50-1Lines changed: 50 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -156,7 +156,7 @@ var _ = Describe("Test placement v1beta1 API validation", func() {
156
156
err:=hubClient.Update(ctx, &crp)
157
157
varstatusErr*k8sErrors.StatusError
158
158
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{})))
159
-
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("placement type is immutable"))
159
+
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("policy cannot be removed once set"))
160
160
})
161
161
162
162
It("should deny update of ClusterResourcePlacement with different placement type", func() {
@@ -613,6 +613,55 @@ var _ = Describe("Test placement v1beta1 API validation", func() {
613
613
})
614
614
})
615
615
616
+
Context("Test ResourcePlacement API validation - invalid cases", func() {
It("should deny update of ResourcePlacement with nil policy", func() {
649
+
rp.Spec.Policy=nil
650
+
err:=hubClient.Update(ctx, &rp)
651
+
varstatusErr*k8sErrors.StatusError
652
+
Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update RP call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{})))
653
+
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("policy cannot be removed once set"))
654
+
})
655
+
656
+
It("should deny update of ResourcePlacement with different placement type", func() {
Expect(errors.As(err, &statusErr)).To(BeTrue(), fmt.Sprintf("Update RP call produced error %s. Error type wanted is %s.", reflect.TypeOf(err), reflect.TypeOf(&k8sErrors.StatusError{})))
661
+
Expect(statusErr.ErrStatus.Message).Should(MatchRegexp("placement type is immutable"))
0 commit comments