diff --git a/go.mod b/go.mod index 7b246b797..32836d81a 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/anchore/syft go 1.18 require ( - github.com/CycloneDX/cyclonedx-go v0.7.0 + github.com/CycloneDX/cyclonedx-go v0.7.1-0.20221222100750-41a1ac565cce github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d github.com/acobaugh/osrelease v0.1.0 github.com/adrg/xdg v0.3.3 @@ -37,7 +37,7 @@ require ( github.com/spf13/cobra v1.6.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.13.0 - github.com/stretchr/testify v1.8.0 + github.com/stretchr/testify v1.8.1 github.com/vifraa/gopom v0.1.0 github.com/wagoodman/go-partybus v0.0.0-20210627031916-db1f5573bbc5 github.com/wagoodman/go-progress v0.0.0-20200731105512-1020f39e6240 @@ -241,7 +241,7 @@ require ( github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spiffe/go-spiffe/v2 v2.1.1 // indirect - github.com/stretchr/objx v0.4.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect github.com/subosito/gotenv v1.4.1 // indirect github.com/sylabs/sif/v2 v2.8.1 // indirect github.com/sylabs/squashfs v0.6.1 // indirect diff --git a/go.sum b/go.sum index 93493416e..032081c4b 100644 --- a/go.sum +++ b/go.sum @@ -153,8 +153,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CycloneDX/cyclonedx-go v0.7.0 h1:jNxp8hL7UpcvPDFXjY+Y1ibFtsW+e5zyF9QoSmhK/zg= -github.com/CycloneDX/cyclonedx-go v0.7.0/go.mod h1:W5Z9w8pTTL+t+yG3PCiFRGlr8PUlE0pGWzKSJbsyXkg= +github.com/CycloneDX/cyclonedx-go v0.7.1-0.20221222100750-41a1ac565cce h1:o5r3msApzvtE5LhcMkxWaKernD/PK0HpMccu7ywBj5Q= +github.com/CycloneDX/cyclonedx-go v0.7.1-0.20221222100750-41a1ac565cce/go.mod h1:XURd0m8zvnLE5aIRqg6JOVRl7qZ/pWBtuFa9EHjQwFc= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= @@ -1875,8 +1875,9 @@ github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v0.0.0-20170130113145-4d4bfba8f1d1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -1889,8 +1890,9 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= diff --git a/syft/formats/common/testutils/utils.go b/syft/formats/common/testutils/utils.go index f672a139e..2104f53b0 100644 --- a/syft/formats/common/testutils/utils.go +++ b/syft/formats/common/testutils/utils.go @@ -9,6 +9,7 @@ import ( "github.com/sergi/go-diff/diffmatchpatch" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/anchore/go-testutils" "github.com/anchore/stereoscope/pkg/filetree" @@ -35,7 +36,7 @@ func FromSnapshot() ImageOption { } } -func AssertEncoderAgainstGoldenImageSnapshot(t *testing.T, format sbom.Format, sbom sbom.SBOM, testImage string, updateSnapshot bool, redactors ...redactor) { +func AssertEncoderAgainstGoldenImageSnapshot(t *testing.T, format sbom.Format, sbom sbom.SBOM, testImage string, updateSnapshot bool, json bool, redactors ...redactor) { var buffer bytes.Buffer // grab the latest image contents and persist @@ -61,15 +62,17 @@ func AssertEncoderAgainstGoldenImageSnapshot(t *testing.T, format sbom.Format, s expected = r(expected) } - // assert that the golden file snapshot matches the actual contents - if !bytes.Equal(expected, actual) { + if json { + require.JSONEq(t, string(expected), string(actual)) + } else if !bytes.Equal(expected, actual) { + // assert that the golden file snapshot matches the actual contents dmp := diffmatchpatch.New() diffs := dmp.DiffMain(string(expected), string(actual), true) t.Errorf("mismatched output:\n%s", dmp.DiffPrettyText(diffs)) } } -func AssertEncoderAgainstGoldenSnapshot(t *testing.T, format sbom.Format, sbom sbom.SBOM, updateSnapshot bool, redactors ...redactor) { +func AssertEncoderAgainstGoldenSnapshot(t *testing.T, format sbom.Format, sbom sbom.SBOM, updateSnapshot bool, json bool, redactors ...redactor) { var buffer bytes.Buffer err := format.Encode(&buffer, sbom) @@ -90,7 +93,9 @@ func AssertEncoderAgainstGoldenSnapshot(t *testing.T, format sbom.Format, sbom s expected = r(expected) } - if !bytes.Equal(expected, actual) { + if json { + require.JSONEq(t, string(expected), string(actual)) + } else if !bytes.Equal(expected, actual) { dmp := diffmatchpatch.New() diffs := dmp.DiffMain(string(expected), string(actual), true) t.Logf("len: %d\nexpected: %s", len(expected), expected) diff --git a/syft/formats/cyclonedxjson/encoder.go b/syft/formats/cyclonedxjson/encoder.go index 3281d2eaf..13ad32f68 100644 --- a/syft/formats/cyclonedxjson/encoder.go +++ b/syft/formats/cyclonedxjson/encoder.go @@ -13,7 +13,7 @@ func encoder(output io.Writer, s sbom.SBOM) error { bom := cyclonedxhelpers.ToFormatModel(s) enc := cyclonedx.NewBOMEncoder(output, cyclonedx.BOMFileFormatJSON) enc.SetPretty(true) - + enc.SetEscapeHTML(false) err := enc.Encode(bom) return err } diff --git a/syft/formats/cyclonedxjson/encoder_test.go b/syft/formats/cyclonedxjson/encoder_test.go index 2928a28cf..005d44b95 100644 --- a/syft/formats/cyclonedxjson/encoder_test.go +++ b/syft/formats/cyclonedxjson/encoder_test.go @@ -15,6 +15,7 @@ func TestCycloneDxDirectoryEncoder(t *testing.T) { Format(), testutils.DirectoryInput(t), *updateCycloneDx, + true, cycloneDxRedactor, ) } @@ -26,19 +27,20 @@ func TestCycloneDxImageEncoder(t *testing.T) { testutils.ImageInput(t, testImage), testImage, *updateCycloneDx, + true, cycloneDxRedactor, ) } func cycloneDxRedactor(s []byte) []byte { serialPattern := regexp.MustCompile(`urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`) - rfc3339Pattern := regexp.MustCompile(`([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))`) + rfc3339Pattern := regexp.MustCompile(`([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))`) sha256Pattern := regexp.MustCompile(`sha256:[A-Fa-f0-9]{64}`) for _, pattern := range []*regexp.Regexp{serialPattern, rfc3339Pattern, sha256Pattern} { - s = pattern.ReplaceAll(s, []byte("redacted")) + s = pattern.ReplaceAll(s, []byte("")) } // the bom-ref will be autogenerated every time, the value here should not be directly tested in snapshot tests - s = regexp.MustCompile(` "bom-ref": .*\n`).ReplaceAll(s, []byte("")) + s = regexp.MustCompile(`\s+"bom-ref":\s*"[^"]+",?\n`).ReplaceAll(s, []byte("")) return s } diff --git a/syft/formats/cyclonedxjson/test-fixtures/snapshot/TestCycloneDxDirectoryEncoder.golden b/syft/formats/cyclonedxjson/test-fixtures/snapshot/TestCycloneDxDirectoryEncoder.golden index a7a90ebaa..7e7a3cdfe 100644 --- a/syft/formats/cyclonedxjson/test-fixtures/snapshot/TestCycloneDxDirectoryEncoder.golden +++ b/syft/formats/cyclonedxjson/test-fixtures/snapshot/TestCycloneDxDirectoryEncoder.golden @@ -1,10 +1,10 @@ { "bomFormat": "CycloneDX", "specVersion": "1.4", - "serialNumber": "urn:uuid:cfd602eb-022b-4a61-84d4-50d34612bd84", + "serialNumber": "urn:uuid:0b628da1-274e-4c24-821c-f9452f37db54", "version": 1, "metadata": { - "timestamp": "2022-11-07T09:11:21-05:00", + "timestamp": "2022-12-22T18:33:51-05:00", "tools": [ { "vendor": "anchore", diff --git a/syft/formats/cyclonedxjson/test-fixtures/snapshot/TestCycloneDxImageEncoder.golden b/syft/formats/cyclonedxjson/test-fixtures/snapshot/TestCycloneDxImageEncoder.golden index 21e034acb..de3018170 100644 --- a/syft/formats/cyclonedxjson/test-fixtures/snapshot/TestCycloneDxImageEncoder.golden +++ b/syft/formats/cyclonedxjson/test-fixtures/snapshot/TestCycloneDxImageEncoder.golden @@ -1,10 +1,10 @@ { "bomFormat": "CycloneDX", "specVersion": "1.4", - "serialNumber": "urn:uuid:ced49687-6384-48fa-a930-ef83a258bf77", + "serialNumber": "urn:uuid:542fc1a1-81ac-4b76-b9e2-8e6b9d8c840a", "version": 1, "metadata": { - "timestamp": "2022-11-07T09:11:21-05:00", + "timestamp": "2022-12-22T18:33:51-05:00", "tools": [ { "vendor": "anchore", @@ -13,7 +13,7 @@ } ], "component": { - "bom-ref": "522dc6b135a55bb4", + "bom-ref": "ffd645a093c0fe70", "type": "container", "name": "user-image-input", "version": "sha256:2731251dc34951c0e50fcc643b4c5f74922dad1a5d98f302b504cf46cd5d9368" @@ -53,7 +53,7 @@ }, { "name": "syft:location:0:layerID", - "value": "sha256:fb6beecb75b39f4bb813dbf177e501edd5ddb3e69bb45cedeb78c676ee1b7a59" + "value": "sha256:62058900d4ce269c900160b8dd255fe310c3a459dda236d041102fa070f84406" }, { "name": "syft:location:0:path", @@ -83,7 +83,7 @@ }, { "name": "syft:location:0:layerID", - "value": "sha256:319b588ce64253a87b533c8ed01cf0025e0eac98e7b516e12532957e1244fdec" + "value": "sha256:623ad97366f39ae279f1925673cdacb4851ddf2e3266f04e63010ec080a098c1" }, { "name": "syft:location:0:path", diff --git a/syft/formats/cyclonedxxml/encoder_test.go b/syft/formats/cyclonedxxml/encoder_test.go index 3d677272c..c7ecd8065 100644 --- a/syft/formats/cyclonedxxml/encoder_test.go +++ b/syft/formats/cyclonedxxml/encoder_test.go @@ -15,6 +15,7 @@ func TestCycloneDxDirectoryEncoder(t *testing.T) { Format(), testutils.DirectoryInput(t), *updateCycloneDx, + false, cycloneDxRedactor, ) } @@ -26,6 +27,7 @@ func TestCycloneDxImageEncoder(t *testing.T) { testutils.ImageInput(t, testImage), testImage, *updateCycloneDx, + false, cycloneDxRedactor, ) } diff --git a/syft/formats/spdxjson/encoder_test.go b/syft/formats/spdxjson/encoder_test.go index 39fa6e3f9..a6050a19c 100644 --- a/syft/formats/spdxjson/encoder_test.go +++ b/syft/formats/spdxjson/encoder_test.go @@ -15,6 +15,7 @@ func TestSPDXJSONDirectoryEncoder(t *testing.T) { Format(), testutils.DirectoryInput(t), *updateSpdxJson, + true, spdxJsonRedactor, ) } @@ -26,6 +27,7 @@ func TestSPDXJSONImageEncoder(t *testing.T) { testutils.ImageInput(t, testImage, testutils.FromSnapshot()), testImage, *updateSpdxJson, + true, spdxJsonRedactor, ) } @@ -39,17 +41,18 @@ func TestSPDXRelationshipOrder(t *testing.T) { s, testImage, *updateSpdxJson, + true, spdxJsonRedactor, ) } func spdxJsonRedactor(s []byte) []byte { // each SBOM reports the time it was generated, which is not useful during snapshot testing - s = regexp.MustCompile(`"created": .*`).ReplaceAll(s, []byte("redacted")) + s = regexp.MustCompile(`"created":\s+"[^"]*",?`).ReplaceAll(s, []byte("")) // each SBOM reports a unique documentNamespace when generated, this is not useful for snapshot testing - s = regexp.MustCompile(`"documentNamespace": .*`).ReplaceAll(s, []byte("redacted")) + s = regexp.MustCompile(`"documentNamespace":\s+"[^"]*",?`).ReplaceAll(s, []byte("")) // the license list will be updated periodically, the value here should not be directly tested in snapshot tests - return regexp.MustCompile(`"licenseListVersion": .*`).ReplaceAll(s, []byte("redacted")) + return regexp.MustCompile(`"licenseListVersion":\s+"[^"]*",?`).ReplaceAll(s, []byte("")) } diff --git a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONDirectoryEncoder.golden b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONDirectoryEncoder.golden index 59bdc67c9..a8041b262 100644 --- a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONDirectoryEncoder.golden +++ b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONDirectoryEncoder.golden @@ -3,14 +3,14 @@ "dataLicense": "CC0-1.0", "SPDXID": "SPDXRef-DOCUMENT", "name": "/some/path", - "documentNamespace": "https://anchore.com/syft/dir/some/path-116e86ba-a976-48ed-909d-9278807ee7fe", + "documentNamespace": "https://anchore.com/syft/dir/some/path-e13c8924-4bbc-42f8-bd30-4e1554472d62", "creationInfo": { "licenseListVersion": "3.19", "creators": [ "Organization: Anchore, Inc", "Tool: syft-v0.42.0-bogus" ], - "created": "2022-12-21T03:39:05Z", + "created": "2022-12-22T23:33:52Z", "comment": "" }, "packages": [ diff --git a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONImageEncoder.golden b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONImageEncoder.golden index 8e9ca38cc..beff67607 100644 --- a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONImageEncoder.golden +++ b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXJSONImageEncoder.golden @@ -3,14 +3,14 @@ "dataLicense": "CC0-1.0", "SPDXID": "SPDXRef-DOCUMENT", "name": "user-image-input", - "documentNamespace": "https://anchore.com/syft/image/user-image-input-006b9b96-66f1-4de3-897f-6583b4358c87", + "documentNamespace": "https://anchore.com/syft/image/user-image-input-a1cc9d58-830a-4a4b-9dcd-f41ea3001216", "creationInfo": { "licenseListVersion": "3.19", "creators": [ "Organization: Anchore, Inc", "Tool: syft-v0.42.0-bogus" ], - "created": "2022-12-21T03:39:05Z", + "created": "2022-12-22T23:33:53Z", "comment": "" }, "packages": [ diff --git a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXRelationshipOrder.golden b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXRelationshipOrder.golden index e88d0f5e6..599488984 100644 --- a/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXRelationshipOrder.golden +++ b/syft/formats/spdxjson/test-fixtures/snapshot/TestSPDXRelationshipOrder.golden @@ -3,14 +3,14 @@ "dataLicense": "CC0-1.0", "SPDXID": "SPDXRef-DOCUMENT", "name": "user-image-input", - "documentNamespace": "https://anchore.com/syft/image/user-image-input-552a9cfc-49ee-4706-81cb-723fd7146b4f", + "documentNamespace": "https://anchore.com/syft/image/user-image-input-fc663ee3-0f9b-402e-827f-3f29aeff164e", "creationInfo": { "licenseListVersion": "3.19", "creators": [ "Organization: Anchore, Inc", "Tool: syft-v0.42.0-bogus" ], - "created": "2022-12-21T03:39:05Z", + "created": "2022-12-22T23:33:53Z", "comment": "" }, "packages": [ diff --git a/syft/formats/spdxtagvalue/encoder_test.go b/syft/formats/spdxtagvalue/encoder_test.go index b5ca75f12..c2b8e4e85 100644 --- a/syft/formats/spdxtagvalue/encoder_test.go +++ b/syft/formats/spdxtagvalue/encoder_test.go @@ -19,6 +19,7 @@ func TestSPDXTagValueDirectoryEncoder(t *testing.T) { Format(), testutils.DirectoryInput(t), *updateSpdxTagValue, + false, spdxTagValueRedactor, ) } @@ -30,6 +31,7 @@ func TestSPDXTagValueImageEncoder(t *testing.T) { testutils.ImageInput(t, testImage, testutils.FromSnapshot()), testImage, *updateSpdxTagValue, + false, spdxTagValueRedactor, ) } @@ -63,6 +65,7 @@ func TestSPDXJSONSPDXIDs(t *testing.T) { }, }, *updateSpdxTagValue, + false, spdxTagValueRedactor, ) } @@ -76,6 +79,7 @@ func TestSPDXRelationshipOrder(t *testing.T) { s, testImage, *updateSpdxTagValue, + false, spdxTagValueRedactor, ) } diff --git a/syft/formats/syftjson/encoder_test.go b/syft/formats/syftjson/encoder_test.go index e20fa33d2..d7d3da95e 100644 --- a/syft/formats/syftjson/encoder_test.go +++ b/syft/formats/syftjson/encoder_test.go @@ -19,6 +19,7 @@ func TestDirectoryEncoder(t *testing.T) { testutils.AssertEncoderAgainstGoldenSnapshot(t, Format(), testutils.DirectoryInput(t), + true, *updateJson, ) } @@ -29,6 +30,7 @@ func TestImageEncoder(t *testing.T) { Format(), testutils.ImageInput(t, testImage, testutils.FromSnapshot()), testImage, + true, *updateJson, ) } @@ -199,5 +201,6 @@ func TestEncodeFullJSONDocument(t *testing.T) { Format(), s, *updateJson, + true, ) } diff --git a/syft/formats/syftjson/test-fixtures/snapshot/TestImageEncoder.golden b/syft/formats/syftjson/test-fixtures/snapshot/TestImageEncoder.golden index 58e455d57..86db095ad 100644 --- a/syft/formats/syftjson/test-fixtures/snapshot/TestImageEncoder.golden +++ b/syft/formats/syftjson/test-fixtures/snapshot/TestImageEncoder.golden @@ -9,7 +9,7 @@ "locations": [ { "path": "/somefile-1.txt", - "layerID": "sha256:fb6beecb75b39f4bb813dbf177e501edd5ddb3e69bb45cedeb78c676ee1b7a59" + "layerID": "sha256:62058900d4ce269c900160b8dd255fe310c3a459dda236d041102fa070f84406" } ], "licenses": [ @@ -40,7 +40,7 @@ "locations": [ { "path": "/somefile-2.txt", - "layerID": "sha256:319b588ce64253a87b533c8ed01cf0025e0eac98e7b516e12532957e1244fdec" + "layerID": "sha256:623ad97366f39ae279f1925673cdacb4851ddf2e3266f04e63010ec080a098c1" } ], "licenses": [], @@ -64,11 +64,11 @@ ], "artifactRelationships": [], "source": { - "id": "1a678f111c8ddc66fd82687bb024e0dd6af61314404937a80e810c0cf317b796", + "id": "6de18113d4a87f3503d13d10d1e69ebe2f5b41880aec96fb506b2113fd8df2f8", "type": "image", "target": { "userInput": "user-image-input", - "imageID": "sha256:3c51b06feb0cda8ee62d0e3755ef2a8496a6b71f8a55b245f07f31c4bb813d31", + "imageID": "sha256:fdd8b25b9402be0c8cf99e1edde6da614310d6bacd2e45a03781a3ef4a59025f", "manifestDigest": "sha256:2731251dc34951c0e50fcc643b4c5f74922dad1a5d98f302b504cf46cd5d9368", "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "tags": [ @@ -78,17 +78,17 @@ "layers": [ { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "digest": "sha256:fb6beecb75b39f4bb813dbf177e501edd5ddb3e69bb45cedeb78c676ee1b7a59", + "digest": "sha256:62058900d4ce269c900160b8dd255fe310c3a459dda236d041102fa070f84406", "size": 22 }, { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "digest": "sha256:319b588ce64253a87b533c8ed01cf0025e0eac98e7b516e12532957e1244fdec", + "digest": "sha256:623ad97366f39ae279f1925673cdacb4851ddf2e3266f04e63010ec080a098c1", "size": 16 } ], - "manifest": "eyJzY2hlbWFWZXJzaW9uIjoyLCJtZWRpYVR5cGUiOiJhcHBsaWNhdGlvbi92bmQuZG9ja2VyLmRpc3RyaWJ1dGlvbi5tYW5pZmVzdC52Mitqc29uIiwiY29uZmlnIjp7Im1lZGlhVHlwZ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jM5YWUyNzlmMTkyNTY3M2NkYWNiNDg1MWRkZjJlMzI2NmYwNGU2MzAxMGVjMDgwYTA5OGMxIl19fQ==", "repoDigests": [], "architecture": "", "os": "" diff --git a/syft/formats/table/encoder_test.go b/syft/formats/table/encoder_test.go index 434ba4028..ebce62e2d 100644 --- a/syft/formats/table/encoder_test.go +++ b/syft/formats/table/encoder_test.go @@ -15,6 +15,7 @@ func TestTableEncoder(t *testing.T) { testutils.AssertEncoderAgainstGoldenSnapshot(t, Format(), testutils.DirectoryInput(t), + false, *updateTableGoldenFiles, ) } diff --git a/syft/formats/template/encoder_test.go b/syft/formats/template/encoder_test.go index b5a46bd29..e41d3109c 100644 --- a/syft/formats/template/encoder_test.go +++ b/syft/formats/template/encoder_test.go @@ -19,6 +19,7 @@ func TestFormatWithOption(t *testing.T) { f, testutils.DirectoryInput(t), *updateTmpl, + false, ) } diff --git a/syft/formats/text/encoder_test.go b/syft/formats/text/encoder_test.go index 3da100b4d..a50d90a1e 100644 --- a/syft/formats/text/encoder_test.go +++ b/syft/formats/text/encoder_test.go @@ -14,6 +14,7 @@ func TestTextDirectoryEncoder(t *testing.T) { Format(), testutils.DirectoryInput(t), *updateTextEncoderGoldenFiles, + false, ) } @@ -24,5 +25,6 @@ func TestTextImageEncoder(t *testing.T) { testutils.ImageInput(t, testImage, testutils.FromSnapshot()), testImage, *updateTextEncoderGoldenFiles, + false, ) }