This is an automated email from the ASF dual-hosted git repository.
bneradt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 118aac656c trafficserver.test.ext: Add enable_cripts (#12475)
118aac656c is described below
commit 118aac656cf05717d86907582a6b29692ebf31f9
Author: Brian Neradt <[email protected]>
AuthorDate: Thu Aug 28 15:53:53 2025 -0500
trafficserver.test.ext: Add enable_cripts (#12475)
This adds the enable_cripts parameter to the MakeCurlCommand to do the
heavy lifting of adding cripts support for autests. It copies down and
configures the tools/compiler.sh script so the test just needs to write
and use a cripts script.
---
tests/gold_tests/autest-site/trafficserver.test.ext | 10 ++++++++++
tests/gold_tests/cripts/cripts.test.py | 19 +------------------
2 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/tests/gold_tests/autest-site/trafficserver.test.ext
b/tests/gold_tests/autest-site/trafficserver.test.ext
index 59a4849b08..061945d8e5 100755
--- a/tests/gold_tests/autest-site/trafficserver.test.ext
+++ b/tests/gold_tests/autest-site/trafficserver.test.ext
@@ -53,6 +53,7 @@ def MakeATSProcess(
enable_cache=True,
enable_quic=False,
enable_uds=True,
+ enable_cripts=False,
block_for_debug=False,
log_data=default_log_data,
use_traffic_out=True,
@@ -403,6 +404,15 @@ def MakeATSProcess(
'proxy.config.udp.threads': 1,
})
+ if enable_cripts:
+ p.Setup.Copy(
+ os.path.join(p.Variables.RepoDir, 'tools', 'cripts',
'compiler.sh'), os.path.join(bin_path, 'cripts_compiler.sh'))
+ p.Disk.records_config.update({
+ 'proxy.config.plugin.compiler_path': os.path.join(bin_path,
'cripts_compiler.sh'),
+ })
+ # ATS_ROOT is used by compiler.sh to find the ATS install directory.
+ p.Env['ATS_ROOT'] = p.Variables.PREFIX
+
# The following message was added so that tests and users can know when
# Traffic Server is ready to both receive and optimize traffic.
p.Ready = When.FileContains(p.Disk.diags_log.AbsPath, "NOTE: Traffic
Server is fully initialized")
diff --git a/tests/gold_tests/cripts/cripts.test.py
b/tests/gold_tests/cripts/cripts.test.py
index b32a65be75..ce46154ee5 100644
--- a/tests/gold_tests/cripts/cripts.test.py
+++ b/tests/gold_tests/cripts/cripts.test.py
@@ -32,7 +32,6 @@ Test.ContinueOnFail = True
class CriptsBasicTest:
def __init__(self):
- self._compiler_location = os.path.join(Test.RunDirectory,
"compiler.sh")
self.setUpOriginServer()
self.setUpTS()
@@ -48,7 +47,7 @@ class CriptsBasicTest:
self.server.addResponse("sessionfile.log", request_header,
response_header)
def setUpTS(self):
- self.ts = Test.MakeATSProcess("ts_in", enable_tls=True,
enable_cache=False)
+ self.ts = Test.MakeATSProcess("ts_in", enable_tls=True,
enable_cache=False, enable_cripts=True)
self.ts.addDefaultSSLFiles()
self.ts.Disk.ssl_multicert_config.AddLine("dest_ip=*
ssl_cert_name=server.pem ssl_key_name=server.key")
@@ -58,7 +57,6 @@ class CriptsBasicTest:
self.ts.Disk.records_config.update(
{
'proxy.config.plugin.dynamic_reload_mode': 1,
- 'proxy.config.plugin.compiler_path': self._compiler_location,
"proxy.config.ssl.server.cert.path":
f"{self.ts.Variables.SSLDir}",
"proxy.config.ssl.server.private_key.path":
f"{self.ts.Variables.SSLDir}",
})
@@ -69,20 +67,6 @@ class CriptsBasicTest:
f'map https://www.example.com:{self.ts.Variables.ssl_port}
http://127.0.0.1:{self.server.Variables.Port} @plugin=basic.cript'
)
- def updateCompilerForTest(self):
- '''Update the compiler script for the install location of the ATS
process.'''
- tr = Test.AddTestRun("Update the compiler script for the install
location of the ATS process.")
- p = tr.Processes.Default
- compiler_source = os.path.join(p.Variables.RepoDir, 'tools', 'cripts',
'compiler.sh')
- p.Setup.Copy(compiler_source, self._compiler_location)
- install_dir = os.path.split(p.Variables.BINDIR)[0]
- # autest doesn't like the -i '' that's necessary on Darwin/macOS
- # sed_in_place = "-i ''" if platform.system() == 'Darwin' else "-i"
- # p.Command = f"sed -i '' 's|\"/tmp/ats\"|\"{install_dir}\"|'
{self._compiler_location}"
- p.Command = (f'perl -pi -e \'s|\\"/tmp/ats\\"|\\"{install_dir}\\"|g\'
{self._compiler_location}')
-
- p.ReturnCode = 0
-
def runHeaderTest(self):
tr = Test.AddTestRun('Exercise traffic through cripts.')
tr.MakeCurlCommand(f'-v -H "Host: www.example.com"
http://127.0.0.1:{self.ts.Variables.port}', ts=self.ts)
@@ -102,7 +86,6 @@ class CriptsBasicTest:
tr.StillRunningAfter = self.server
def run(self):
- self.updateCompilerForTest()
self.runHeaderTest()
if not Condition.CurlUsingUnixDomainSocket():
self.runCertsTest()