From 4c46c878dab2b47c2b84784e861c2a33d76e5ea2 Mon Sep 17 00:00:00 2001 From: Laurence Man Date: Wed, 10 Jun 2020 10:06:59 -0700 Subject: [PATCH] markups: Add another test --- lib/validator/v3/validator_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/validator/v3/validator_test.go b/lib/validator/v3/validator_test.go index ecc713ee3..efbbd70a2 100644 --- a/lib/validator/v3/validator_test.go +++ b/lib/validator/v3/validator_test.go @@ -1658,6 +1658,21 @@ func init() { }, }, false, ), + Entry("disallow global() in EntityRule selector field", + &api.GlobalNetworkPolicy{ + ObjectMeta: v1.ObjectMeta{Name: "thing"}, + Spec: api.GlobalNetworkPolicySpec{ + Ingress: []api.Rule{ + { + Action: "Allow", + Source: api.EntityRule{ + Selector: "global()", + }, + }, + }, + }, + }, false, + ), Entry("allow global() in EntityRule namespaceSelector field", &api.GlobalNetworkPolicy{ ObjectMeta: v1.ObjectMeta{Name: "thing"}, @@ -1668,6 +1683,9 @@ func init() { Source: api.EntityRule{ NamespaceSelector: "global()", }, + Destination: api.EntityRule{ + NamespaceSelector: "global()", + }, }, }, },