cmcfarlen commented on code in PR #13658:
URL: https://github.com/apache/trafficserver/pull/13658#discussion_r3973344214


##########
src/config/unit_tests/test_storage.cc:
##########
@@ -37,12 +39,27 @@ using namespace config;
 namespace
 {
 
+// Test cases run as separate, concurrent ctest processes, so they cannot 
share one
+// temp directory: a fixed file name would let one case delete another's file 
mid-read.
+// A directory per process rather than a unique file name keeps the file names 
these
+// tests depend on, e.g. a legacy storage.config finding its sibling 
volume.config.
+std::filesystem::path const &
+per_process_temp_dir()
+{
+  static std::filesystem::path const dir = [] {
+    auto d = std::filesystem::temp_directory_path() / ("ats_config_test." + 
std::to_string(getpid()));
+    std::filesystem::create_directories(d);
+    return d;
+  }();
+  return dir;
+}

Review Comment:
   Fixed in 29169dfa6e — extracted to 
`src/config/unit_tests/config_test_temp_file.h`.
   
   Worth noting the duplication predates this PR: the `TempFile` class itself 
was already copy-pasted byte-identically into all three files, and I had only 
added a fourth duplicated helper alongside it. The new header takes both, so 
the three test files now share one copy (net -129 lines).
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to