Skip to content

Pull out additional Generate logic into functions; add tests#1059

Merged
egibs merged 8 commits into
chainguard-dev:mainfrom
egibs:report-tests
Jul 28, 2025
Merged

Pull out additional Generate logic into functions; add tests#1059
egibs merged 8 commits into
chainguard-dev:mainfrom
egibs:report-tests

Conversation

@egibs

@egibs egibs commented Jul 26, 2025

Copy link
Copy Markdown
Member

Follow-up for #1055 with the promised tests. I pulled most of the remaining conditional logic into functions that are much easier to test and added tests for the respective functions and relocated the somewhat-redundant size/checksum calculation which can be done as part of the initial file scan.

For the checksum calculations, we can use MinIO's sha256-simd package which is quite a bit faster to eliminate some of the overhead.

I also continued the trend of using iota values instead of the direct integers since it may not be apparent that an integer is actually a severity.

Key points:

  • The tests pass and should capture most of the states we care about
  • The new functions caused no test data drift

Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs requested a review from stevebeattie July 26, 2025 01:18
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
egibs added 6 commits July 26, 2025 17:39
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs merged commit 35a119c into chainguard-dev:main Jul 28, 2025
12 checks passed
@egibs egibs deleted the report-tests branch August 2, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants