fix(test): isolate cache directory for downloader tests#4812
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the reliability of the downloader test suite by eliminating potential resource conflicts and test interference. By moving away from a hardcoded directory in the user's home folder to dynamically generated temporary directories, the tests can now safely run in parallel without side effects. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request replaces the hardcoded global cacheDir with a dynamically generated temporary directory (dt.cacheDir) using os.MkdirTemp in the downloader tests, improving test isolation and cleanup. The reviewer suggests using AssertEq instead of ExpectEq when verifying the temporary directory creation to fail fast, and advises checking if dt.fakeStorage is nil in TearDown to prevent potential nil pointer panics if setup fails early.
Use os.MkdirTemp to create a unique temporary cache directory for each downloaderTest run instead of using a shared directory in $HOME. Creating a temporary directory under a fixed name in $HOME is unsafe and leads to test interference and resource conflicts when running tests in parallel. TAG=agy CONV=ac1f66fe-728b-45e3-88c1-8e5f724a1f6f
c40685c to
cf49df4
Compare
Use os.MkdirTemp to create a unique temporary cache directory for each downloaderTest run instead of using a shared directory in $HOME. Creating a temporary directory under a fixed name in $HOME is unsafe and leads to test interference and resource conflicts when running tests in parallel.
TAG=agy
CONV=ac1f66fe-728b-45e3-88c1-8e5f724a1f6f