Skip to content

Commit

Permalink
fix failing test for MeshGateway
Browse files Browse the repository at this point in the history
Signed-off-by: alparslanavci <[email protected]>
  • Loading branch information
alparslanavci committed Oct 7, 2023
1 parent bf1bf5b commit 5492de6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/plugins/policies/core/matchers/validators/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ func ValidateTargetRef(
verr.Add(disallowedField("name", ref.Name, refKind))
verr.Add(disallowedField("mesh", ref.Mesh, refKind))
verr.Add(validTags(ref.Tags))
case common_api.MeshService, common_api.MeshGateway, common_api.MeshHTTPRoute:
case common_api.MeshService, common_api.MeshHTTPRoute:
verr.Add(requiredField("name", ref.Name, refKind))
verr.Add(validName(ref.Name))
verr.Add(disallowedField("mesh", ref.Mesh, refKind))
verr.Add(disallowedField("tags", ref.Tags, refKind))
case common_api.MeshServiceSubset:
case common_api.MeshServiceSubset, common_api.MeshGateway:
verr.Add(requiredField("name", ref.Name, refKind))
verr.Add(validName(ref.Name))
verr.Add(disallowedField("mesh", ref.Mesh, refKind))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ name: backend
inputYaml: `
kind: MeshGateway
name: gateway1
tags:
listener: one
`,
opts: &matcher_validators.ValidateTargetRefOpts{
SupportedKinds: []common_api.TargetRefKind{
Expand Down Expand Up @@ -410,11 +412,10 @@ violations:
message: cannot be set with kind MeshGateway
`,
}),
Entry("MeshGateway without name with tags", testCase{
Entry("MeshGateway without name with empty tags", testCase{
inputYaml: `
kind: MeshGateway
tags:
tag1: value1
tags: {}
`,
opts: &matcher_validators.ValidateTargetRefOpts{
SupportedKinds: []common_api.TargetRefKind{
Expand All @@ -425,8 +426,6 @@ tags:
violations:
- field: targetRef.name
message: must be set with kind MeshGateway
- field: targetRef.tags
message: cannot be set with kind MeshGateway
`,
}),
Entry("MeshGateway with invalid name", testCase{
Expand Down

0 comments on commit 5492de6

Please sign in to comment.