From 451cb9d5ca4b6ac755fda37e73c57d7803ed3fe3 Mon Sep 17 00:00:00 2001 From: Keith Zantow Date: Wed, 26 Apr 2023 16:42:43 -0400 Subject: [PATCH] chore: update test redactor ordering (#1765) Signed-off-by: Keith Zantow --- syft/formats/internal/testutils/utils.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/syft/formats/internal/testutils/utils.go b/syft/formats/internal/testutils/utils.go index f6edb54f9..8014d3fdb 100644 --- a/syft/formats/internal/testutils/utils.go +++ b/syft/formats/internal/testutils/utils.go @@ -47,13 +47,14 @@ func AssertEncoderAgainstGoldenImageSnapshot(t *testing.T, format sbom.Format, s err := format.Encode(&buffer, sbom) assert.NoError(t, err) - actual := redact(buffer.Bytes(), redactors...) + actual := buffer.Bytes() // replace the expected snapshot contents with the current encoder contents if updateSnapshot { testutils.UpdateGoldenFileContents(t, actual) } + actual = redact(actual, redactors...) expected := redact(testutils.GetGoldenFileContents(t), redactors...) if json { @@ -71,13 +72,14 @@ func AssertEncoderAgainstGoldenSnapshot(t *testing.T, format sbom.Format, sbom s err := format.Encode(&buffer, sbom) assert.NoError(t, err) - actual := redact(buffer.Bytes(), redactors...) + actual := buffer.Bytes() // replace the expected snapshot contents with the current encoder contents if updateSnapshot { testutils.UpdateGoldenFileContents(t, actual) } + actual = redact(actual, redactors...) expected := redact(testutils.GetGoldenFileContents(t), redactors...) if json {