From c2cf4eb7b02e41f8992091322281c0893947a51e Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Thu, 5 Nov 2020 16:35:31 -0500 Subject: [PATCH] update tests for the new distro information Signed-off-by: Alfredo Deza --- syft/presenter/json/presenter_test.go | 8 +++++--- .../snapshot/TestJsonDirsPresenter.golden | 4 ++++ .../snapshot/TestJsonImgsPresenter.golden | 12 ++++++++---- .../stereoscope-fixture-image-simple.golden | Bin 23552 -> 22016 bytes 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/syft/presenter/json/presenter_test.go b/syft/presenter/json/presenter_test.go index f3e79815b..b935050a2 100644 --- a/syft/presenter/json/presenter_test.go +++ b/syft/presenter/json/presenter_test.go @@ -8,6 +8,7 @@ import ( "github.com/anchore/go-testutils" "github.com/anchore/stereoscope/pkg/file" "github.com/anchore/stereoscope/pkg/imagetest" + "github.com/anchore/syft/syft/distro" "github.com/anchore/syft/syft/pkg" "github.com/anchore/syft/syft/scope" "github.com/sergi/go-diff/diffmatchpatch" @@ -39,12 +40,12 @@ func TestJsonDirsPresenter(t *testing.T) { {Path: "/some/path/pkg1"}, }, }) - + d := distro.NewUnknownDistro() s, err := scope.NewScopeFromDir("/some/path") if err != nil { t.Fatal(err) } - pres := NewPresenter(catalog, s) + pres := NewPresenter(catalog, s, d) // run presenter err = pres.Present(&buffer) @@ -100,7 +101,8 @@ func TestJsonImgsPresenter(t *testing.T) { }) s, err := scope.NewScopeFromImage(img, scope.AllLayersScope) - pres := NewPresenter(catalog, s) + d := distro.NewUnknownDistro() + pres := NewPresenter(catalog, s, d) // run presenter err = pres.Present(&buffer) diff --git a/syft/presenter/json/test-fixtures/snapshot/TestJsonDirsPresenter.golden b/syft/presenter/json/test-fixtures/snapshot/TestJsonDirsPresenter.golden index e73fecc86..a56d23169 100644 --- a/syft/presenter/json/test-fixtures/snapshot/TestJsonDirsPresenter.golden +++ b/syft/presenter/json/test-fixtures/snapshot/TestJsonDirsPresenter.golden @@ -26,5 +26,9 @@ "source": { "type": "directory", "target": "/some/path" + }, + "distro": { + "name": "", + "version": "" } } diff --git a/syft/presenter/json/test-fixtures/snapshot/TestJsonImgsPresenter.golden b/syft/presenter/json/test-fixtures/snapshot/TestJsonImgsPresenter.golden index 62d379db2..85957c9ba 100644 --- a/syft/presenter/json/test-fixtures/snapshot/TestJsonImgsPresenter.golden +++ b/syft/presenter/json/test-fixtures/snapshot/TestJsonImgsPresenter.golden @@ -35,26 +35,30 @@ "layers": [ { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "digest": "sha256:e158b57d6f5a96ef5fd22f2fe76c70b5ba6ff5b2619f9d83125b2aad0492ac7b", + "digest": "sha256:78783bfc74fef84f899b4977561ad1172f87753f82cc2157b06bf097e56dfbce", "size": 22 }, { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "digest": "sha256:da21056e7bf4308ecea0c0836848a7fe92f38fdcf35bc09ee6d98e7ab7beeebf", + "digest": "sha256:54ec7f643dafbf9f27032a5e60afe06248c0e99b50aed54bb0fe28ea4825ccaf", "size": 16 }, { "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "digest": "sha256:f0e18aa6032c24659a9c741fc36ca56f589782ea132061ccf6f52b952403da94", + "digest": "sha256:ec4775a139c45b1ddf9ea8e1cb43385e92e5c0bf6ec2e3f4192372785b18c106", "size": 27 } ], "size": 65, - "digest": "sha256:2731251dc34951c0e50fcc643b4c5f74922dad1a5d98f302b504cf46cd5d9368", + "digest": "sha256:fedd7bcc0b90f071501b662d8e7c9ac7548b88daba6b3deedfdf33f22ed8d95b", "mediaType": "application/vnd.docker.distribution.manifest.v2+json", "tags": [ "stereoscope-fixture-image-simple:04e16e44161c8888a1a963720fd0443cbf7eef8101434c431de8725cd98cc9f7" ] } + }, + "distro": { + "name": "", + "version": "" } } diff --git a/syft/presenter/json/test-fixtures/snapshot/stereoscope-fixture-image-simple.golden b/syft/presenter/json/test-fixtures/snapshot/stereoscope-fixture-image-simple.golden index 4e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