bneradt commented on code in PR #13198:
URL: https://github.com/apache/trafficserver/pull/13198#discussion_r3293720914


##########
src/mgmt/rpc/server/unit_tests/test_rpcserver.cc:
##########
@@ -71,8 +72,32 @@ add_method_handler(const std::string &name, Func &&call)
 
 namespace
 {
-const std::string sockPath{"tests/var/jsonrpc20_test.sock"};
-const std::string lockPath{"tests/var/jsonrpc20_test.lock"};
+fs::path const &
+rpc_test_dir()
+{
+  static const fs::path dir = []() {
+    auto            path = fs::temp_directory_path() / 
fs::path("ats_jsonrpcserver_" + std::to_string(getpid()));
+    std::error_code ec;
+
+    fs::remove_all(path, ec);
+    ec.clear();
+    if (!fs::create_directories(path, ec, 0700) && ec) {
+      throw std::runtime_error{"Failed to create JSONRPC test directory: " + 
ec.message()};
+    }

Review Comment:
   Good point. I moved JSONRPC test directory creation out of static 
initialization and into testRunStarting, so setup failures are reported through 
Catch with context instead of terminating the test binary before Catch starts.
   
   



-- 
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