Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
Signed-off-by: Simar <simar@linux.com>
  • Loading branch information
simar7 committed May 29, 2023
1 parent 7fd81c8 commit 19462de
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 112 deletions.
110 changes: 55 additions & 55 deletions pkg/fanal/artifact/image/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,17 @@ func TestArtifact_Inspect(t *testing.T) {
missingBlobsExpectation: cache.ArtifactCacheMissingBlobsExpectation{
Args: cache.ArtifactCacheMissingBlobsArgs{
ArtifactID: "sha256:c232b7d8ac8aa08aa767313d0b53084c4380d1c01a213a5971bdb039e6538313",
BlobIDs: []string{"sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef"},
BlobIDs: []string{"sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897"},
},
Returns: cache.ArtifactCacheMissingBlobsReturns{
MissingArtifact: true,
MissingBlobIDs: []string{"sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef"},
MissingBlobIDs: []string{"sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897"},
},
},
putBlobExpectations: []cache.ArtifactCachePutBlobExpectation{
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef",
BlobID: "sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand Down Expand Up @@ -322,7 +322,7 @@ func TestArtifact_Inspect(t *testing.T) {
Name: "../../test/testdata/alpine-311.tar.gz",
Type: types.ArtifactContainerImage,
ID: "sha256:c232b7d8ac8aa08aa767313d0b53084c4380d1c01a213a5971bdb039e6538313",
BlobIDs: []string{"sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef"},
BlobIDs: []string{"sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897"},
ImageMetadata: types.ImageMetadata{
ID: "sha256:a187dde48cd289ac374ad8539930628314bc581a481cdb41409c9289419ddb72",
DiffIDs: []string{
Expand Down Expand Up @@ -381,25 +381,25 @@ func TestArtifact_Inspect(t *testing.T) {
Args: cache.ArtifactCacheMissingBlobsArgs{
ArtifactID: "sha256:33f9415ed2cd5a9cef5d5144333619745b9ec0f851f0684dd45fa79c6b26a650",
BlobIDs: []string{
"sha256:e085b302e2bdf10ed0873cc35314373caa62f7cf491a3a7f084abc557bc3ecfb",
"sha256:a6595f0322efa4a1557e59f052875923aa6f026afeea923b5fbcaeabaa0029c9",
"sha256:2334ba1fd17dc73d761522cfa477d13604d9dd9872fa7c06895ac44bb6736965",
"sha256:9e7df9d6ed0a9f7d6753800f820f3558313cf928f2917a76f510685c06635dc9",
"sha256:db2b5b2f26f320b80ee549495888f111151fdb44fecb2c432dfd928e96978e74",
"sha256:718d6a3d0a24966f2d9f64e0c86695d1bb896fe81df634b85300d34142c80174",
"sha256:9f6bc14198fa983fd47079bcd82df1391bee8e529a8a131a0305874eb0a51ca0",
"sha256:44264715b7132cd14cd956bf385d5f875603461f5adeafde7fdecabe2e266291",
},
},
Returns: cache.ArtifactCacheMissingBlobsReturns{
MissingBlobIDs: []string{
"sha256:e085b302e2bdf10ed0873cc35314373caa62f7cf491a3a7f084abc557bc3ecfb",
"sha256:a6595f0322efa4a1557e59f052875923aa6f026afeea923b5fbcaeabaa0029c9",
"sha256:2334ba1fd17dc73d761522cfa477d13604d9dd9872fa7c06895ac44bb6736965",
"sha256:9e7df9d6ed0a9f7d6753800f820f3558313cf928f2917a76f510685c06635dc9",
"sha256:db2b5b2f26f320b80ee549495888f111151fdb44fecb2c432dfd928e96978e74",
"sha256:718d6a3d0a24966f2d9f64e0c86695d1bb896fe81df634b85300d34142c80174",
"sha256:9f6bc14198fa983fd47079bcd82df1391bee8e529a8a131a0305874eb0a51ca0",
"sha256:44264715b7132cd14cd956bf385d5f875603461f5adeafde7fdecabe2e266291",
},
},
},
putBlobExpectations: []cache.ArtifactCachePutBlobExpectation{
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:e085b302e2bdf10ed0873cc35314373caa62f7cf491a3a7f084abc557bc3ecfb",
BlobID: "sha256:db2b5b2f26f320b80ee549495888f111151fdb44fecb2c432dfd928e96978e74",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand Down Expand Up @@ -487,7 +487,7 @@ func TestArtifact_Inspect(t *testing.T) {
},
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:a6595f0322efa4a1557e59f052875923aa6f026afeea923b5fbcaeabaa0029c9",
BlobID: "sha256:718d6a3d0a24966f2d9f64e0c86695d1bb896fe81df634b85300d34142c80174",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand Down Expand Up @@ -583,7 +583,7 @@ func TestArtifact_Inspect(t *testing.T) {
},
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:2334ba1fd17dc73d761522cfa477d13604d9dd9872fa7c06895ac44bb6736965",
BlobID: "sha256:9f6bc14198fa983fd47079bcd82df1391bee8e529a8a131a0305874eb0a51ca0",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand Down Expand Up @@ -707,7 +707,7 @@ func TestArtifact_Inspect(t *testing.T) {
},
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:9e7df9d6ed0a9f7d6753800f820f3558313cf928f2917a76f510685c06635dc9",
BlobID: "sha256:44264715b7132cd14cd956bf385d5f875603461f5adeafde7fdecabe2e266291",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand Down Expand Up @@ -1516,10 +1516,10 @@ func TestArtifact_Inspect(t *testing.T) {
Type: types.ArtifactContainerImage,
ID: "sha256:33f9415ed2cd5a9cef5d5144333619745b9ec0f851f0684dd45fa79c6b26a650",
BlobIDs: []string{
"sha256:e085b302e2bdf10ed0873cc35314373caa62f7cf491a3a7f084abc557bc3ecfb",
"sha256:a6595f0322efa4a1557e59f052875923aa6f026afeea923b5fbcaeabaa0029c9",
"sha256:2334ba1fd17dc73d761522cfa477d13604d9dd9872fa7c06895ac44bb6736965",
"sha256:9e7df9d6ed0a9f7d6753800f820f3558313cf928f2917a76f510685c06635dc9",
"sha256:db2b5b2f26f320b80ee549495888f111151fdb44fecb2c432dfd928e96978e74",
"sha256:718d6a3d0a24966f2d9f64e0c86695d1bb896fe81df634b85300d34142c80174",
"sha256:9f6bc14198fa983fd47079bcd82df1391bee8e529a8a131a0305874eb0a51ca0",
"sha256:44264715b7132cd14cd956bf385d5f875603461f5adeafde7fdecabe2e266291",
},
ImageMetadata: types.ImageMetadata{
ID: "sha256:58701fd185bda36cab0557bb6438661831267aa4a9e0b54211c4d5317a48aff4",
Expand Down Expand Up @@ -1613,25 +1613,25 @@ func TestArtifact_Inspect(t *testing.T) {
Args: cache.ArtifactCacheMissingBlobsArgs{
ArtifactID: "sha256:33f9415ed2cd5a9cef5d5144333619745b9ec0f851f0684dd45fa79c6b26a650",
BlobIDs: []string{
"sha256:9a7c29b10391bcedce533e9609c58ec0e7b0132692fd287bd40592816d1bfbef",
"sha256:e15c92866a85305a909ae200974937d6febcd7a504aeb32ad0a01371c245c25e",
"sha256:6cfccd64a1b1ead1b517bad7dfda8aa0616f63a2d93e71921ff51cb70f447567",
"sha256:032128f06ff805d1ec38f171ea6ae60639175eb70bc80e2b3abc91f6fbfa343d",
"sha256:dc2c102de2a4dc82bc017564a2c1a46646f071367bd51d3ddd80171dc5a78ffe",
"sha256:e6bc45e7459162f5a27dd7bd310a420f27378f2ea24c6ed5f0a083f2377bde24",
"sha256:8184bee7b1985e0abd72288946c246b90e1847b36fdcd50ca3d588b9371ec920",
"sha256:f1bb0ccf476528c6165a2f1a74d0e5a0cb06c9b254a0def6b1183db662e83dd4",
},
},
Returns: cache.ArtifactCacheMissingBlobsReturns{
MissingBlobIDs: []string{
"sha256:9a7c29b10391bcedce533e9609c58ec0e7b0132692fd287bd40592816d1bfbef",
"sha256:e15c92866a85305a909ae200974937d6febcd7a504aeb32ad0a01371c245c25e",
"sha256:6cfccd64a1b1ead1b517bad7dfda8aa0616f63a2d93e71921ff51cb70f447567",
"sha256:032128f06ff805d1ec38f171ea6ae60639175eb70bc80e2b3abc91f6fbfa343d",
"sha256:dc2c102de2a4dc82bc017564a2c1a46646f071367bd51d3ddd80171dc5a78ffe",
"sha256:e6bc45e7459162f5a27dd7bd310a420f27378f2ea24c6ed5f0a083f2377bde24",
"sha256:8184bee7b1985e0abd72288946c246b90e1847b36fdcd50ca3d588b9371ec920",
"sha256:f1bb0ccf476528c6165a2f1a74d0e5a0cb06c9b254a0def6b1183db662e83dd4",
},
},
},
putBlobExpectations: []cache.ArtifactCachePutBlobExpectation{
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:9a7c29b10391bcedce533e9609c58ec0e7b0132692fd287bd40592816d1bfbef",
BlobID: "sha256:dc2c102de2a4dc82bc017564a2c1a46646f071367bd51d3ddd80171dc5a78ffe",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand All @@ -1642,7 +1642,7 @@ func TestArtifact_Inspect(t *testing.T) {
},
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:e15c92866a85305a909ae200974937d6febcd7a504aeb32ad0a01371c245c25e",
BlobID: "sha256:e6bc45e7459162f5a27dd7bd310a420f27378f2ea24c6ed5f0a083f2377bde24",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand All @@ -1653,7 +1653,7 @@ func TestArtifact_Inspect(t *testing.T) {
},
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:6cfccd64a1b1ead1b517bad7dfda8aa0616f63a2d93e71921ff51cb70f447567",
BlobID: "sha256:8184bee7b1985e0abd72288946c246b90e1847b36fdcd50ca3d588b9371ec920",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand All @@ -1665,7 +1665,7 @@ func TestArtifact_Inspect(t *testing.T) {
},
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:032128f06ff805d1ec38f171ea6ae60639175eb70bc80e2b3abc91f6fbfa343d",
BlobID: "sha256:f1bb0ccf476528c6165a2f1a74d0e5a0cb06c9b254a0def6b1183db662e83dd4",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand All @@ -1681,10 +1681,10 @@ func TestArtifact_Inspect(t *testing.T) {
Type: types.ArtifactContainerImage,
ID: "sha256:33f9415ed2cd5a9cef5d5144333619745b9ec0f851f0684dd45fa79c6b26a650",
BlobIDs: []string{
"sha256:9a7c29b10391bcedce533e9609c58ec0e7b0132692fd287bd40592816d1bfbef",
"sha256:e15c92866a85305a909ae200974937d6febcd7a504aeb32ad0a01371c245c25e",
"sha256:6cfccd64a1b1ead1b517bad7dfda8aa0616f63a2d93e71921ff51cb70f447567",
"sha256:032128f06ff805d1ec38f171ea6ae60639175eb70bc80e2b3abc91f6fbfa343d",
"sha256:dc2c102de2a4dc82bc017564a2c1a46646f071367bd51d3ddd80171dc5a78ffe",
"sha256:e6bc45e7459162f5a27dd7bd310a420f27378f2ea24c6ed5f0a083f2377bde24",
"sha256:8184bee7b1985e0abd72288946c246b90e1847b36fdcd50ca3d588b9371ec920",
"sha256:f1bb0ccf476528c6165a2f1a74d0e5a0cb06c9b254a0def6b1183db662e83dd4",
},
ImageMetadata: types.ImageMetadata{
ID: "sha256:58701fd185bda36cab0557bb6438661831267aa4a9e0b54211c4d5317a48aff4",
Expand Down Expand Up @@ -1767,7 +1767,7 @@ func TestArtifact_Inspect(t *testing.T) {
missingBlobsExpectation: cache.ArtifactCacheMissingBlobsExpectation{
Args: cache.ArtifactCacheMissingBlobsArgs{
ArtifactID: "sha256:c232b7d8ac8aa08aa767313d0b53084c4380d1c01a213a5971bdb039e6538313",
BlobIDs: []string{"sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef"},
BlobIDs: []string{"sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897"},
},
Returns: cache.ArtifactCacheMissingBlobsReturns{
Err: xerrors.New("MissingBlobs failed"),
Expand All @@ -1781,16 +1781,16 @@ func TestArtifact_Inspect(t *testing.T) {
missingBlobsExpectation: cache.ArtifactCacheMissingBlobsExpectation{
Args: cache.ArtifactCacheMissingBlobsArgs{
ArtifactID: "sha256:c232b7d8ac8aa08aa767313d0b53084c4380d1c01a213a5971bdb039e6538313",
BlobIDs: []string{"sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef"},
BlobIDs: []string{"sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897"},
},
Returns: cache.ArtifactCacheMissingBlobsReturns{
MissingBlobIDs: []string{"sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef"},
MissingBlobIDs: []string{"sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897"},
},
},
putBlobExpectations: []cache.ArtifactCachePutBlobExpectation{
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef",
BlobID: "sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand Down Expand Up @@ -1853,26 +1853,26 @@ func TestArtifact_Inspect(t *testing.T) {
Args: cache.ArtifactCacheMissingBlobsArgs{
ArtifactID: "sha256:33f9415ed2cd5a9cef5d5144333619745b9ec0f851f0684dd45fa79c6b26a650",
BlobIDs: []string{
"sha256:e085b302e2bdf10ed0873cc35314373caa62f7cf491a3a7f084abc557bc3ecfb",
"sha256:a6595f0322efa4a1557e59f052875923aa6f026afeea923b5fbcaeabaa0029c9",
"sha256:2334ba1fd17dc73d761522cfa477d13604d9dd9872fa7c06895ac44bb6736965",
"sha256:9e7df9d6ed0a9f7d6753800f820f3558313cf928f2917a76f510685c06635dc9",
"sha256:db2b5b2f26f320b80ee549495888f111151fdb44fecb2c432dfd928e96978e74",
"sha256:718d6a3d0a24966f2d9f64e0c86695d1bb896fe81df634b85300d34142c80174",
"sha256:9f6bc14198fa983fd47079bcd82df1391bee8e529a8a131a0305874eb0a51ca0",
"sha256:44264715b7132cd14cd956bf385d5f875603461f5adeafde7fdecabe2e266291",
},
},
Returns: cache.ArtifactCacheMissingBlobsReturns{
MissingBlobIDs: []string{
"sha256:e085b302e2bdf10ed0873cc35314373caa62f7cf491a3a7f084abc557bc3ecfb",
"sha256:a6595f0322efa4a1557e59f052875923aa6f026afeea923b5fbcaeabaa0029c9",
"sha256:2334ba1fd17dc73d761522cfa477d13604d9dd9872fa7c06895ac44bb6736965",
"sha256:9e7df9d6ed0a9f7d6753800f820f3558313cf928f2917a76f510685c06635dc9",
"sha256:db2b5b2f26f320b80ee549495888f111151fdb44fecb2c432dfd928e96978e74",
"sha256:718d6a3d0a24966f2d9f64e0c86695d1bb896fe81df634b85300d34142c80174",
"sha256:9f6bc14198fa983fd47079bcd82df1391bee8e529a8a131a0305874eb0a51ca0",
"sha256:44264715b7132cd14cd956bf385d5f875603461f5adeafde7fdecabe2e266291",
},
},
},
putBlobExpectations: []cache.ArtifactCachePutBlobExpectation{
{

Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:e085b302e2bdf10ed0873cc35314373caa62f7cf491a3a7f084abc557bc3ecfb",
BlobID: "sha256:db2b5b2f26f320b80ee549495888f111151fdb44fecb2c432dfd928e96978e74",
BlobInfoAnything: true,
},

Expand All @@ -1883,7 +1883,7 @@ func TestArtifact_Inspect(t *testing.T) {
{

Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:a6595f0322efa4a1557e59f052875923aa6f026afeea923b5fbcaeabaa0029c9",
BlobID: "sha256:718d6a3d0a24966f2d9f64e0c86695d1bb896fe81df634b85300d34142c80174",
BlobInfoAnything: true,
},

Expand All @@ -1894,7 +1894,7 @@ func TestArtifact_Inspect(t *testing.T) {
{

Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:2334ba1fd17dc73d761522cfa477d13604d9dd9872fa7c06895ac44bb6736965",
BlobID: "sha256:9f6bc14198fa983fd47079bcd82df1391bee8e529a8a131a0305874eb0a51ca0",
BlobInfoAnything: true,
},

Expand All @@ -1905,7 +1905,7 @@ func TestArtifact_Inspect(t *testing.T) {
{

Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:9e7df9d6ed0a9f7d6753800f820f3558313cf928f2917a76f510685c06635dc9",
BlobID: "sha256:44264715b7132cd14cd956bf385d5f875603461f5adeafde7fdecabe2e266291",
BlobInfoAnything: true,
},

Expand All @@ -1922,17 +1922,17 @@ func TestArtifact_Inspect(t *testing.T) {
missingBlobsExpectation: cache.ArtifactCacheMissingBlobsExpectation{
Args: cache.ArtifactCacheMissingBlobsArgs{
ArtifactID: "sha256:c232b7d8ac8aa08aa767313d0b53084c4380d1c01a213a5971bdb039e6538313",
BlobIDs: []string{"sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef"},
BlobIDs: []string{"sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897"},
},
Returns: cache.ArtifactCacheMissingBlobsReturns{
MissingArtifact: true,
MissingBlobIDs: []string{"sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef"},
MissingBlobIDs: []string{"sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897"},
},
},
putBlobExpectations: []cache.ArtifactCachePutBlobExpectation{
{
Args: cache.ArtifactCachePutBlobArgs{
BlobID: "sha256:0addd7b03c55b1db5584bc70623c165ef10ea4a5f0b4d3a88c4309ff13b063ef",
BlobID: "sha256:0366f81c3cbeac047536f9ca133b5632544c8342544922c3ed8a3e51c0250897",
BlobInfo: types.BlobInfo{
SchemaVersion: types.BlobJSONSchemaVersion,
Digest: "",
Expand Down
Loading

0 comments on commit 19462de

Please sign in to comment.