Skip to content

Commit 1dac314

Browse files
authored
Add CEL validation tests for ObservabilityPolicy CRD (#3735)
1 parent 0a3cb1a commit 1dac314

File tree

2 files changed

+386
-1
lines changed

2 files changed

+386
-1
lines changed

tests/cel/common.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const (
3636
// ClientSettingsPolicy validation errors.
3737
const (
3838
expectedTargetRefKindError = `TargetRef Kind must be one of: Gateway, HTTPRoute, or GRPCRoute`
39-
expectedTargetRefGroupError = `TargetRef Group must be gateway.networking.k8s.io.`
39+
expectedTargetRefGroupError = `TargetRef Group must be gateway.networking.k8s.io`
4040
expectedHeaderWithoutServerError = `header can only be specified if server is specified`
4141
)
4242

@@ -47,6 +47,13 @@ const (
4747
expectedMinReplicasLessThanOrEqualError = `minReplicas must be less than or equal to maxReplicas`
4848
)
4949

50+
// ObservabilityPolicy validation errors.
51+
const (
52+
expectedTargetRefMustBeHTTPRouteOrGrpcRouteError = `TargetRef Kind must be: HTTPRoute or GRPCRoute`
53+
expectedTargetRefKindAndNameComboMustBeUnique = `TargetRef Kind and Name combination must be unique`
54+
expectedStrategyMustBeOfTypeRatio = `ratio can only be specified if strategy is of type ratio`
55+
)
56+
5057
// UpstreamSettingsPolicy validation errors.
5158
const (
5259
expectedTargetRefKindServiceError = `TargetRefs Kind must be: Service`

0 commit comments

Comments
 (0)