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


##########
tests/gold_tests/autest-site/cli_tools.test.ext:
##########
@@ -39,10 +39,28 @@ def spawn_commands(self, cmdstr, count, retcode=0, 
use_default=True):
     for cnt in range(0, count):
         
ret.append(self.Processes.Process(name="cmdline-{num}".format(num=cnt), 
cmdstr=cmdstr, returncode=retcode))
     if use_default:
-        self.Processes.Default.Command = cmdstr
+        self.CurlCommand(cmdstr)
         self.Processes.Default.ReturnCode = retcode
         self.Processes.Default.StartBefore(*ret)
     return ret
 
 
+def curl_command(self, cmd):
+    if self.Variables.get("CurlUds", False):
+        self.Processes.Default.Command = 'curl --unix-socket /tmp/socket ' + 
cmd
+    else:
+        self.Processes.Default.Command = 'curl ' + cmd
+
+
+def curl_multiple_commands(self, cmd):
+    if self.Variables.get("CurlUds", False):
+        self.Processes.Default.Command = cmd.format(curl='curl --unix-socket 
/tmp/socket')
+    else:
+        self.Processes.Default.Command = cmd.format(curl='curl')
+
+
 ExtendTestRun(spawn_commands, name="SpawnCommands")
+ExtendTestRun(curl_command, name="CurlCommand")
+ExtendTest(curl_command, name="CurlCommand")
+ExtendTestRun(curl_multiple_commands, name="CurlCommandMulti")
+ExtendTest(curl_multiple_commands, name="CurlCommandMulti")

Review Comment:
   Looks good. A couple API observations:
   
   * Our typical pattern is to name these extansions that create Processes with 
`Make` prefixes. `MakeATSProcess`, `MakeDNServer`, `MakeOriginServer`, etc.
   * As a convenience to the caller, these functions return the configured 
Process value.
   
   For the latter, a possible example would be:
   
   ```python
       p = self.Processes.Default
       if self.Variables.get("CurlUds", False):
           p.Command = 'curl --unix-socket /tmp/socket ' + cmd
       else:
           p.Command = 'curl ' + cmd
       return p
   ```



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