-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libcnb-test: Clean up Docker volumes after each test
When using `pack build`, by default Pack will create two Docker volumes for caching - one for the build layer cache, and the other for the launch layer cache. Pack bases the names for these volumes on the app image name, so that the next time a build is performed with the same app image name, the associated cache is used for that rebuild. When libcnb-test runs tests, it intentionally uses a random Docker image name for each new test, and then tears down the image and any associated containers after the tests. However, until now the Docker volumes automatically created by Pack were not being removed, which can cause issues when running the tests locally, since the Docker VM can run out of disk space - as seen in #570. The leftover volumes can also be seen in the tests log output added in #740. Pack doesn't currently offer a "clean up the volumes associated with this app name" feature, so we have to remove these volumes manually. To do so we need the volume name - which we achieve by generating a name ourselves, and passing it to `pack build` using the `--cache` options, so Pack uses our volume name instead of generating its own automatic volume name. Since we're now cleaning up not only images but volumes too, I've refactored the way resources are cleaned up, to reduce the amount of duplication (since otherwise we'd need to handle the "still clean up for expected failures" case for volumes too). This new implementation also solves #735 and #736. Fixes #570. Fixes #735. Fixes #736. GUS-W-13195631. GUS-W-14503186. GUS-W-14503192.
- Loading branch information
Showing
6 changed files
with
124 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters