Skip to content

Commit

Permalink
jar: add integration test for corrupt jar file
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Frost <[email protected]>
  • Loading branch information
frostmar authored and crozzy committed Aug 30, 2023
1 parent 2452121 commit 012a54b
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions java/packagescanner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@ func TestScan(t *testing.T) {
defer done()
t.Run(path.Base(tinkerpop.Name), tinkerpop.Run(ctx))
t.Run(path.Base(jenkins.Name), jenkins.RunSubset(ctx, 226))
t.Run(path.Base(db2CorruptJar.Name), db2CorruptJar.RunSubset(ctx, 184))
}

var db2CorruptJar = test.ScannerTestcase{
Domain: "docker.io",
Name: "ibmcom/db2",
Hash: "sha256:52c13866cd8bb6811be5ea51605f7d7777a666a3fde9beab03ee088e556fd142",
// Layer contains a corrupt jar file which should be skipped harmlessly:
// /opt/ibm/db2/V11.1/samples/repl/xmlpubtk/loadqueue/LoadQueue.jar
// Want is just one arbitrary other jar to prove the scan does not have a fatal error
Want: []*claircore.Package{
{
Name: "com.ibm.db2.jcc",
Version: "1.4.0",
Kind: "binary",
PackageDB: "jar:opt/ibm/db2/V11.5/db2tss/lib/db2jcc4.jar",
RepositoryHint: "sha1:902856c6b9f979facc6f75fad40da6b048df5df8",
},
},
Scanner: &java.Scanner{},
}

var tinkerpop = test.ScannerTestcase{
Expand Down

0 comments on commit 012a54b

Please sign in to comment.