Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libcnb-test: Check the exit code of pack sbom download #520

Merged
merged 1 commit into from
Oct 18, 2022

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Oct 18, 2022

Previously if the pack sbom download command exited non-zero, TestContext::download_sbom_files would ignore the error and return an SbomFiles referencing an empty directory.

Now, such errors will result in a test panic showing the stdout/stderr from pack - like already occurs for errors during pack build.

I tried writing an integration test for this, however wasn't able to find an easy way to make pack sbom download fail (it appears to succeed even for images that don't have any SBOMs for example, and I don't want to resort to having to make manual docker rmi <image> calls etc). However the implementation is already tested via the pack build consumer, so this could be worse.

Fixes #519.
GUS-W-11924792.

@edmorley edmorley added bug Something isn't working libcnb-test labels Oct 18, 2022
@edmorley edmorley self-assigned this Oct 18, 2022
Previously if the `pack sbom download` command exited non-zero,
`TestContext::download_sbom_files` would ignore the error and
return an `SbomFiles` referencing an empty directory.

Now, such errors will result in a test panic showing the stdout/stderr
from pack - like already occurs for errors during `pack build`.

I tried writing an integration test for this, however wasn't able to find
an easy way to make `pack sbom` fail (it appears to succeed even for
images that don't have any SBOMs). However the implementation is
already tested via the `pack build` consumer, so this could be worse.

GUS-W-11924792.
@edmorley edmorley force-pushed the edmorley/download-sbom-exit-code branch from 3701bb0 to a9985c0 Compare October 18, 2022 09:59
@edmorley edmorley marked this pull request as ready for review October 18, 2022 10:03
@edmorley edmorley requested a review from a team as a code owner October 18, 2022 10:03
Copy link
Member

@Malax Malax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, 👍🏻!

@edmorley edmorley merged commit 60b95a0 into main Oct 18, 2022
@edmorley edmorley deleted the edmorley/download-sbom-exit-code branch October 18, 2022 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working libcnb-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TestContext::download_sbom_files() doesn't check the exit code of pack sbom download
2 participants