Skip to content

test: add unit coverage for generated SBOM contents - #5222

Draft
gangadhar-res wants to merge 1 commit into
zarf-dev:mainfrom
gangadhar-res:test/sbom-content-coverage
Draft

test: add unit coverage for generated SBOM contents#5222
gangadhar-res wants to merge 1 commit into
zarf-dev:mainfrom
gangadhar-res:test/sbom-content-coverage

Conversation

@gangadhar-res

Copy link
Copy Markdown

Fixes #5159

The existing SBOM tests only asserted non-empty output. This adds content-level assertions against the parsed syft-json documents:

  • createImageSBOM: an image layer carrying an apk installed database must yield the expected packages (name/version/type apk), the zarf descriptor, source and schema metadata, and artifact relationships.
  • createFileSBOM: a component tar carrying a requirements.txt must yield the expected python packages, the zarf descriptor and relationships, and write identical bytes to zarf-component-.json.

Fixture expectations are derived from current output on main, so a Syft upgrade produces a focused, reviewable diff instead of silent drift.

Test-only change; go test ./src/pkg/packager/assemble/ green locally.

@netlify

netlify Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit c700e3b
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/6a7eb8ded6b18200081ff817

The existing tests only asserted that SBOM generation produced
non-empty output. Add content-level assertions against the parsed
syft-json documents:

- createImageSBOM: an image layer carrying an apk installed database
  must yield the expected packages (name, version, type apk), the zarf
  descriptor, a source, schema metadata and artifact relationships.
- createFileSBOM: a component tar carrying a requirements.txt must
  yield the expected python packages, the zarf descriptor and
  relationships, and write the same bytes to
  zarf-component-<name>.json.

Fixture expectations are derived from current output on main so a Syft
upgrade produces a focused, reviewable diff instead of silent drift.

Fixes zarf-dev#5159

Signed-off-by: Gangadhar Chalapaka <gangadhar@resolve.ai>
@gangadhar-res
gangadhar-res force-pushed the test/sbom-content-coverage branch from 0e0b959 to c700e3b Compare August 14, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add unit coverage for generated SBOM contents

1 participant