Skip to content

Commit

Permalink
add mariner snapshot tests (#347)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <[email protected]>
  • Loading branch information
wagoodman authored Oct 18, 2023
1 parent a3d559b commit 0dd478a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schema":"https://raw.githubusercontent.com/anchore/vunnel/main/schema/vulnerability/os/schema-1.0.0.json","identifier":"mariner:2.0/CVE-2022-3736","item":{"Vulnerability":{"Name":"CVE-2022-3736","NamespaceName":"mariner:2.0","Description":"CVE-2022-3736 affecting package bind 9.16.33-1. No patch is available currently.","Severity":"High","Link":"https://nvd.nist.gov/vuln/detail/CVE-2022-3736","CVSS":[],"FixedIn":[{"Name":"bind","NamespaceName":"mariner:2.0","VersionFormat":"rpm","Version":"None","Module":"","VendorAdvisory":{"NoAdvisory":false,"AdvisorySummary":[]}}],"Metadata":{}}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schema":"https://raw.githubusercontent.com/anchore/vunnel/main/schema/vulnerability/os/schema-1.0.0.json","identifier":"mariner:2.0/CVE-2023-21977","item":{"Vulnerability":{"Name":"CVE-2023-21977","NamespaceName":"mariner:2.0","Description":"CVE-2023-21977 affecting package mysql 8.0.32-1. An upgraded version of the package is available that resolves this issue.","Severity":"Medium","Link":"https://nvd.nist.gov/vuln/detail/CVE-2023-21977","CVSS":[],"FixedIn":[{"Name":"mysql","NamespaceName":"mariner:2.0","VersionFormat":"rpm","Version":"0:8.0.33-1.cm2","Module":"","VendorAdvisory":{"NoAdvisory":false,"AdvisorySummary":[]}}],"Metadata":{}}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"schema":"https://raw.githubusercontent.com/anchore/vunnel/main/schema/vulnerability/os/schema-1.0.0.json","identifier":"mariner:2.0/CVE-2023-21980","item":{"Vulnerability":{"Name":"CVE-2023-21980","NamespaceName":"mariner:2.0","Description":"CVE-2023-21980 affecting package mysql 8.0.32-1. An upgraded version of the package is available that resolves this issue.","Severity":"High","Link":"https://nvd.nist.gov/vuln/detail/CVE-2023-21980","CVSS":[],"FixedIn":[{"Name":"mysql","NamespaceName":"mariner:2.0","VersionFormat":"rpm","Version":"0:8.0.33-1.cm2","Module":"","VendorAdvisory":{"NoAdvisory":false,"AdvisorySummary":[]}}],"Metadata":{}}}}
20 changes: 20 additions & 0 deletions tests/unit/providers/mariner/test_mariner.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,23 @@ def mock_download(*args, **kwargs):

assert 3 == workspace.num_result_entries()
assert workspace.result_schemas_valid(require_entries=True)


def test_provider_via_snapshot(helpers, disable_get_requests, monkeypatch):
workspace = helpers.provider_workspace_helper(name=Provider.name())

c = Config(allow_versions=["2.0"])
c.runtime.result_store = result.StoreStrategy.FLAT_FILE
p = Provider(root=workspace.root, config=c)

mock_data_path = helpers.local_dir("test-fixtures/mariner-truncated-2.0-oval.xml")
shutil.copy(mock_data_path, workspace.input_dir / "mariner-truncated-2.0-oval.xml")

def mock_download(*args, **kwargs):
return [mock_data_path]

monkeypatch.setattr(p.parser, "_download", mock_download)

p.update(None)

workspace.assert_result_snapshots()

0 comments on commit 0dd478a

Please sign in to comment.