-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lucas Rodriguez <[email protected]>
- Loading branch information
1 parent
7dfa436
commit d94742b
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package grype | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/anchore/grype/grype/db" | ||
"github.com/anchore/grype/internal" | ||
) | ||
|
||
// this benchmark was added to measure the performance | ||
// of LoadVulnerabilityDB, specifically in regards to hash validation. | ||
// https://github.com/anchore/grype/issues/1502 | ||
func BenchmarkLoadVulnerabilityDB(b *testing.B) { | ||
cfg := db.Config{ | ||
DBRootDir: filepath.Join(".tmp", "grype-db"), | ||
ListingURL: internal.DBUpdateURL, | ||
ValidateByHashOnGet: true, | ||
} | ||
for range b.N { | ||
_, _, _, err := LoadVulnerabilityDB(cfg, true) | ||
if err != nil { | ||
b.Fatal(err) | ||
} | ||
} | ||
} |