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

Fix image deletion in integration tests #519

Closed
nitzmahone opened this issue May 4, 2023 · 0 comments · Fixed by #531
Closed

Fix image deletion in integration tests #519

nitzmahone opened this issue May 4, 2023 · 0 comments · Fixed by #531

Comments

@nitzmahone
Copy link
Member

#516 disabled the inline image deletion from integration tests, as it would sometimes corrupt the build cache. Test images will just pile up now- not a problem for CI, but definitely a problem for local execution.

We don't want to just blindly prune or otherwise blast images that our test might not have created (at least not without also marking such tests as destructive), but the distributed nature of pytest-xdist complicates the necessary bookkeeping to defer explicit image deletion until the end of the session, since only the workers know what images they created, but the main session teardown hook runs in the main controller long after the required data is lost.

One idea:

  • Have delete_image record the image names in a per-runtime set that's tied to a session-scoped fixture. At fixture teardown, merely append the data to well-known filenames in the session tempdir (using a lockfile/mutex or atomic write, since multiple workers may hit it at once). Then have the main session or unload hook read all the names for each runtime into a set (as some may be duplicated across workers) and best-effort delete all the images in those files, producing warnings if there are problems.
@github-actions github-actions bot added the needs_triage New item that needs to be triaged label May 4, 2023
This was referenced May 10, 2023
@Shrews Shrews removed the needs_triage New item that needs to be triaged label May 16, 2023
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 a pull request may close this issue.

2 participants