You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2021/11/08 23:03:42 UTC

[trafficserver] branch 9.2.x updated: tests: Adjust generated file paths to work within some restricted environments (#8499)

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.2.x by this push:
     new 6794eeb  tests: Adjust generated file paths to work within some restricted environments (#8499)
6794eeb is described below

commit 6794eebe5b5205997c5b3ac2247ae33c666bd789
Author: Randall Meyer <rr...@apple.com>
AuthorDate: Mon Nov 8 08:34:19 2021 -0800

    tests: Adjust generated file paths to work within some restricted environments (#8499)
    
    Following up to the work originally done in 36440ef17
    
    (cherry picked from commit aee5a61d15e3ada231a14e12f366f11765934491)
---
 tests/gold_tests/pluginTest/lua/lua_header_table.test.py |  4 +++-
 tests/gold_tests/pluginTest/tsapi/tsapi.test.py          | 11 +++++------
 tests/gold_tests/tls/tls_session_key_logging.test.py     | 13 ++++++++-----
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/tests/gold_tests/pluginTest/lua/lua_header_table.test.py b/tests/gold_tests/pluginTest/lua/lua_header_table.test.py
index 7fdf775..16d746a 100644
--- a/tests/gold_tests/pluginTest/lua/lua_header_table.test.py
+++ b/tests/gold_tests/pluginTest/lua/lua_header_table.test.py
@@ -29,8 +29,10 @@ Test.ContinueOnFail = True
 ts = Test.MakeATSProcess("ts")
 
 ts.Disk.remap_config.AddLine(
-    f"map / http://127.0.0.1 @plugin=tslua.so @pparam={Test.TestDirectory}/header_table.lua"
+    f"map / http://127.0.0.1 @plugin=tslua.so @pparam=header_table.lua"
 )
+# Configure the tslua's configuration file.
+ts.Setup.Copy("header_table.lua", ts.Variables.CONFIGDIR)
 
 # Test - Check for header table
 tr = Test.AddTestRun("Lua Header Table")
diff --git a/tests/gold_tests/pluginTest/tsapi/tsapi.test.py b/tests/gold_tests/pluginTest/tsapi/tsapi.test.py
index fbdfbf4..b992609 100644
--- a/tests/gold_tests/pluginTest/tsapi/tsapi.test.py
+++ b/tests/gold_tests/pluginTest/tsapi/tsapi.test.py
@@ -27,11 +27,6 @@ Test.SkipUnless(
 Test.ContinueOnFail = True
 
 plugin_name = "test_tsapi"
-log_file_name = "log.txt"
-
-
-# The test plugin will output test logging to this file.
-Test.Env["OUTPUT_FILE"] = os.path.join(Test.RunDirectory, log_file_name)
 
 server = Test.MakeOriginServer("server")
 
@@ -49,6 +44,10 @@ server.addResponse("sessionlog.json", request_header, response_header)
 # server.
 ts = Test.MakeATSProcess("ts", select_ports=True, enable_tls=True, enable_cache=False)
 
+# The test plugin will output test logging to this file.
+log_file_name = os.path.join(ts.Variables.LOGDIR, "log.txt")
+Test.Env["OUTPUT_FILE"] = log_file_name
+
 ts.addDefaultSSLFiles()
 
 ts.Disk.records_config.update({
@@ -99,7 +98,7 @@ tr.Processes.Default.ReturnCode = 0
 
 tr = Test.AddTestRun()
 # Change server port number (which can vary) to a fixed string for compare to gold file.
-second_log_file_name = "log2.txt"
+second_log_file_name = os.path.join(ts.Variables.LOGDIR, "log2.txt")
 tr.Processes.Default.Command = f"sed 's/{server.Variables.Port}/SERVER_PORT/' < {log_file_name} > {second_log_file_name}"
 tr.Processes.Default.ReturnCode = 0
 f = tr.Disk.File(second_log_file_name)
diff --git a/tests/gold_tests/tls/tls_session_key_logging.test.py b/tests/gold_tests/tls/tls_session_key_logging.test.py
index 1e40363..1720cf6 100644
--- a/tests/gold_tests/tls/tls_session_key_logging.test.py
+++ b/tests/gold_tests/tls/tls_session_key_logging.test.py
@@ -28,7 +28,6 @@ Test TLS secrets logging.
 class TlsKeyloggingTest:
 
     replay_file = "tls_session_key_logging.replay.yaml"
-    keylog_file = os.path.join(Test.RunDirectory, "tls_secrets.txt")
 
     server_counter = 0
     ts_counter = 0
@@ -48,6 +47,7 @@ class TlsKeyloggingTest:
         ts_name = f"ts_{TlsKeyloggingTest.ts_counter}"
         TlsKeyloggingTest.ts_counter += 1
         self.ts = Test.MakeATSProcess(ts_name, enable_tls=True, enable_cache=False)
+
         self.ts.addDefaultSSLFiles()
         self.ts.Disk.records_config.update({
             "proxy.config.ssl.server.cert.path": f'{self.ts.Variables.SSLDir}',
@@ -63,21 +63,24 @@ class TlsKeyloggingTest:
         self.ts.Disk.remap_config.AddLine(
             f'map / https://127.0.0.1:{self.server.Variables.https_port}'
         )
+
+        keylog_file = os.path.join(self.ts.Variables.LOGDIR, "tls_secrets.txt")
+
         if enable_secrets_logging:
             self.ts.Disk.records_config.update({
-                'proxy.config.ssl.keylog_file': TlsKeyloggingTest.keylog_file,
+                'proxy.config.ssl.keylog_file': keylog_file,
             })
 
             self.ts.Disk.diags_log.Content += Testers.ContainsExpression(
-                f"Opened {TlsKeyloggingTest.keylog_file} for TLS key logging",
+                f"Opened {keylog_file} for TLS key logging",
                 "Verify the user was notified of TLS secrets logging.")
-            self.ts.Disk.File(TlsKeyloggingTest.keylog_file, id="keylog", exists=True)
+            self.ts.Disk.File(keylog_file, id="keylog", exists=True)
             # It would be nice to verify the content of certain lines in the
             # keylog file, but the content is dependent upon the particular TLS
             # protocol version. Thus I'm hesitant to add ContainsExpression
             # checks here which will be fragile and eventually become outdated.
         else:
-            self.ts.Disk.File(TlsKeyloggingTest.keylog_file, exists=False)
+            self.ts.Disk.File(keylog_file, exists=False)
 
     def run(self):
         tr = Test.AddTestRun()