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: Fix image cleanup when a pack build unexpectedly succeeds #625

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Aug 8, 2023

Previously, if a test with an expected result of PackResult::Failure unexpectedly succeeded, the built app image was left behind since cleanup was only performed in TestContext::Drop (and in this scenario, a TestContext is never created in the first place).

Now the app image is correctly cleaned up.

This scenario is hard to write a test for unless we resort to std::panic::catch_unwind and manual Docker inspect subprocess calls, which is not really worth it - so I've just tested manually instead.

Fixes #586.
Closes #588.
GUS-W-13903181.

Previously, if a test with an expected result of `PackResult::Failure`
unexpectedly succeeded, the built app image was left behind since
cleanup was only performed in `TestContext::Drop` (and in this
scenario, a `TestContext` is never created in the first place).

Now the app image is correctly cleaned up.

Fixes #586.
Closes #588.
GUS-W-13903181.
@edmorley edmorley added bug Something isn't working libcnb-test labels Aug 8, 2023
@edmorley edmorley self-assigned this Aug 8, 2023
@edmorley edmorley marked this pull request as ready for review August 8, 2023 08:32
@edmorley edmorley requested a review from a team as a code owner August 8, 2023 08:32
@edmorley edmorley enabled auto-merge (squash) August 8, 2023 08:32
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.

Neat impl, agree wrt tests. 👍🏻

@edmorley edmorley merged commit 3332439 into main Aug 8, 2023
@edmorley edmorley deleted the edmorley/fix-image-leak branch August 8, 2023 08:53
edmorley added a commit that referenced this pull request Aug 8, 2023
Since #625 was a bug fix not a change.
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.

libcnb-test: Images not cleaned up when pack build unexpectedly suceeeds
2 participants