From e1ec6299b01fd8823693404ef0ee0f3fbb617c08 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Sun, 21 Jul 2024 21:09:33 +0000 Subject: [PATCH] fix: null vs empty object comparison (#1673) (#1674) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché Co-authored-by: Charles-Edouard Brétéché --- go.mod | 2 +- go.sum | 4 ++-- testdata/e2e/examples/quick-start/README.md | 3 ++- testdata/e2e/examples/quick-start/chainsaw-test.yaml | 10 ++++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 9668a05f5..614671564 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/hashicorp/go-getter v1.7.5 github.com/jmespath-community/go-jmespath v1.1.2-0.20240627155901-bdbb290f571e github.com/kudobuilder/kuttl v0.18.0 - github.com/kyverno/kyverno-json v0.0.3 + github.com/kyverno/kyverno-json v0.0.4-0.20240721204454-61c433c46e92 github.com/kyverno/pkg/ext v0.0.0-20240418121121-df8add26c55c github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 github.com/prometheus/common v0.47.0 diff --git a/go.sum b/go.sum index 21223a7fc..f6a00fe26 100644 --- a/go.sum +++ b/go.sum @@ -481,8 +481,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kudobuilder/kuttl v0.18.0 h1:WeoxTamWd8AXVj6NWH1PCaV8CEXavaPJiExbm2J7bcI= github.com/kudobuilder/kuttl v0.18.0/go.mod h1:ZXR6RcZg9CBYvVPgd2eaGLn3o0ihSvYQOCvwaN+psaw= -github.com/kyverno/kyverno-json v0.0.3 h1:EImI/YV41dG4hDQer/W0qMZHfxqul1yiHrBEXxFrkGM= -github.com/kyverno/kyverno-json v0.0.3/go.mod h1:KUgXPXwUh0Sm/UgtHPomZAfEX8v79I3B5RZbUlzNihg= +github.com/kyverno/kyverno-json v0.0.4-0.20240721204454-61c433c46e92 h1:Q36uQjX/r7LdKv04bdaManCjbbh4v35y5wkKU8TUIiM= +github.com/kyverno/kyverno-json v0.0.4-0.20240721204454-61c433c46e92/go.mod h1:3LgZogzltja+Sx0o5CIa7d7+991v8sWXHskU0fWSOsQ= github.com/kyverno/pkg/ext v0.0.0-20240418121121-df8add26c55c h1:lAolpR9H8BwM5lRRvgCQ8JowswyxZRH+fgtIQzHFVCk= github.com/kyverno/pkg/ext v0.0.0-20240418121121-df8add26c55c/go.mod h1:02vxM0GNXz9+B/i6+rMfWAIwibUuAH+qFsd73IFskgQ= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= diff --git a/testdata/e2e/examples/quick-start/README.md b/testdata/e2e/examples/quick-start/README.md index 388ff0b90..a49401048 100644 --- a/testdata/e2e/examples/quick-start/README.md +++ b/testdata/e2e/examples/quick-start/README.md @@ -6,7 +6,7 @@ | # | Name | Bindings | Try | Catch | Finally | Cleanup | |:-:|---|:-:|:-:|:-:|:-:| -| 1 | [step-1](#step-step-1) | 0 | 2 | 0 | 0 | 0 | +| 1 | [step-1](#step-step-1) | 0 | 3 | 0 | 0 | 0 | ### Step: `step-1` @@ -18,6 +18,7 @@ |:-:|---|:-:|:-:|---| | 1 | `apply` | 0 | 0 | *No description* | | 2 | `assert` | 0 | 0 | *No description* | +| 3 | `error` | 0 | 0 | *No description* | --- diff --git a/testdata/e2e/examples/quick-start/chainsaw-test.yaml b/testdata/e2e/examples/quick-start/chainsaw-test.yaml index 33df19c83..6d82f7505 100644 --- a/testdata/e2e/examples/quick-start/chainsaw-test.yaml +++ b/testdata/e2e/examples/quick-start/chainsaw-test.yaml @@ -14,3 +14,13 @@ spec: - assert: # file is relative to the test folder file: configmap.yaml + # this make sure a non-existent field cannot be compared to an empty object + - error: + resource: + apiVersion: v1 + kind: ConfigMap + metadata: + name: chainsaw-quick-start + status: + vulnerabilitySummary: + severityCount: {}