Skip to content

Commit

Permalink
fix: make test_SBOM robust to data changes
Browse files Browse the repository at this point in the history
  • Loading branch information
terriko committed May 15, 2024
1 parent 9f5b2d7 commit 2dd5e57
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,16 @@ def test_SBOM(self, caplog):
assert (
known_cves_message is not None
), "Expected 3 products with cves, none found"
assert known_cves_message == "There are 3 products with known CVEs detected"

# since sometimes this test breaks due to data changes, let's just say we want at least 2
# products with cves (though there should be 3 at time of writing)
m = re.match(
r"There are (?P<product_number>\d*) products with known CVEs detected",
known_cves_message,
)
assert (
int(m.group("product_number")) > 2
), "Not enough products with cves found in output"

def test_sbom_detection(self, caplog):
SBOM_PATH = Path(__file__).parent.resolve() / "sbom"
Expand Down

0 comments on commit 2dd5e57

Please sign in to comment.