libcnb-test: Test container, volume and image cleanup in CI #740
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the end of each test libcnb-test is meant to clean up any Docker resources that were created during the test. However, this functionality currently isn't tested, and we've found several cases where cleanup wasn't occurring as expected:
pack build
unexpectedly suceeeds #586libcnb-test
#570TestContext::start_container
leaves behind the container if it failed to start #737We could try and add a Rust integration test or two to check that cleanup works in the common case, however, as seen by the issues above, it's often in the edge cases where resource cleanup wasn't working. In addition, testing cleanup during an individual test is hard, since other tests will be running at the same time, so we'd have to check for individual image or container names, which would miss cases like #570.
As such, it's much easier for us to instead just check that there are zero unexpected resources left behind at the end of the existing entire libcnb-test test suite.
For now, two of the checks don't cause CI to fail, since the fixes for the cleanup implementations have not yet landed.
GUS-W-14502524.