From 844646ccdbe7c43a4e9961d0c8af419d8219dbad Mon Sep 17 00:00:00 2001 From: Tyler Slaton Date: Tue, 25 Jan 2022 14:41:54 -0500 Subject: [PATCH] refactor(constraint): update none compound constraint to be not Signed-off-by: Tyler Slaton --- pkg/constraints/constraint.go | 9 +++++---- pkg/constraints/constraint_test.go | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/pkg/constraints/constraint.go b/pkg/constraints/constraint.go index 57ef2937d..f65e8725d 100644 --- a/pkg/constraints/constraint.go +++ b/pkg/constraints/constraint.go @@ -25,14 +25,15 @@ type Constraint struct { // GVK defines a constraint for a GVK. GVK *GVKConstraint `json:"gvk,omitempty" yaml:"gvk,omitempty"` - // All, Any, and None are compound constraints. See this enhancement for details: + // All, Any, and Not are compound constraints. See this enhancement for details: // https://github.com/operator-framework/enhancements/blob/master/enhancements/compound-bundle-constraints.md All *CompoundConstraint `json:"all,omitempty" yaml:"all,omitempty"` Any *CompoundConstraint `json:"any,omitempty" yaml:"any,omitempty"` - // A note on None: this constraint is not particularly useful by itself. + // A note on Not: this constraint isn't particularly useful by itself. // It should be used within an All constraint alongside some other constraint type - // since saying "none of these GVKs/packages/etc." without an alternative doesn't make sense. - None *CompoundConstraint `json:"none,omitempty" yaml:"none,omitempty"` + // since saying "do not use any of these GVKs/packages/etc." without an alternative + // doesn't make sense. + Not *CompoundConstraint `json:"not,omitempty" yaml:"not,omitempty"` } // CompoundConstraint holds a list of potentially nested constraints diff --git a/pkg/constraints/constraint_test.go b/pkg/constraints/constraint_test.go index d62bd5820..a2df76dca 100644 --- a/pkg/constraints/constraint_test.go +++ b/pkg/constraints/constraint_test.go @@ -65,11 +65,11 @@ func TestParse(t *testing.T) { }, }, { - name: "Valid/BasicNone", - input: json.RawMessage(fmt.Sprintf(inputBasicCompoundTmpl, "none")), + name: "Valid/BasicNot", + input: json.RawMessage(fmt.Sprintf(inputBasicCompoundTmpl, "not")), expConstraint: Constraint{ FailureMessage: "blah", - None: &CompoundConstraint{ + Not: &CompoundConstraint{ Constraints: []Constraint{ { FailureMessage: "blah blah", @@ -109,7 +109,7 @@ func TestParse(t *testing.T) { }, }, { - None: &CompoundConstraint{ + Not: &CompoundConstraint{ Constraints: []Constraint{ {GVK: &GVKConstraint{Group: "bazs.example.com", Kind: "Baz", Version: "v1alpha1"}}, }, @@ -256,7 +256,7 @@ const ( } }, { - "none": { + "not": { "constraints": [ { "gvk": {