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 713cf2e5cf autest: tighten config_update_interval_ms (#12541)
713cf2e5cf is described below

commit 713cf2e5cfbaea40b73889dbbf79eb7e8082a4b2
Author: Brian Neradt <[email protected]>
AuthorDate: Mon Oct 6 13:09:33 2025 -0500

    autest: tighten config_update_interval_ms (#12541)
    
    This sets the default proxy.config.config_update_interval_ms to 20ms so
    that config reloads are done more quickly. This required fixing a couple
    things:
    
    * the config update logic didn't work with this new config setting when
      the other config updates were run later in the trafficserver.test.ext
      file.
    * the ssl_key_dialog which was accidentally working because the final
      TestRun was running before the config reload completed. This fixes the
      test to systematically wait for the config reload to fail and has the
      curl command use the correct passphrases now.
---
 tests/gold_tests/autest-site/trafficserver.test.ext         | 13 ++++++++-----
 tests/gold_tests/cache/cache-generation-clear.test.py       |  1 -
 tests/gold_tests/cache/cache-generation-disjoint.test.py    |  1 -
 tests/gold_tests/cache/disjoint-wait-for-cache.test.py      |  1 -
 tests/gold_tests/tls/ssl_key_dialog.test.py                 | 12 +++++++++++-
 tests/gold_tests/traffic_ctl/gold/diff.gold                 |  3 +++
 tests/gold_tests/traffic_ctl/gold/diff_yaml.gold            |  1 +
 .../traffic_ctl/traffic_ctl_server_output.test.py           |  4 ++--
 8 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/tests/gold_tests/autest-site/trafficserver.test.ext 
b/tests/gold_tests/autest-site/trafficserver.test.ext
index 061945d8e5..a76762d029 100755
--- a/tests/gold_tests/autest-site/trafficserver.test.ext
+++ b/tests/gold_tests/autest-site/trafficserver.test.ext
@@ -383,6 +383,9 @@ def MakeATSProcess(
             'proxy.config.ssl.keylog_file': tmpname,
         })
 
+    # For config reload tests, no need to wait the default 3 seconds to detect 
the need for a reload.
+    p.Disk.records_config.update({'proxy.config.config_update_interval_ms': 
20})
+
     if enable_cache:
         # In records.yaml, the cache is enabled by default so there's nothing
         # we have to do here to functionally enable it. However, the tests that
@@ -557,16 +560,17 @@ class YAMLFile(File):
         else:
             return content  # Already an object.
 
-    def __update(self, content, out):
+    def __update(self, content: dict, out: dict):
         for key, value in content.items():
             if key in out:
-                if isinstance(out[key], dict) == False:
-                    out.update(content)
+                if not isinstance(out[key], dict):
+                    # Simple: just set the value.
+                    out[key] = value
                     continue
 
+                # Recurse: update the nested dictionary.
                 self.__update(value, out[key])
             else:
-                out[key] = {}
                 out[key] = value
 
     def update(self, content):
@@ -602,7 +606,6 @@ class RecordsYAML(YAMLFile):
     def __legacy_update(self, obj, new_doc=False):
         config = {}
         for name, value in obj.items():
-            ori_name = name
             if name.startswith("proxy.config."):
                 name = name[len("proxy.config."):]
             elif name.startswith("local.config."):
diff --git a/tests/gold_tests/cache/cache-generation-clear.test.py 
b/tests/gold_tests/cache/cache-generation-clear.test.py
index 2d5e77d853..94e7d4d5f5 100644
--- a/tests/gold_tests/cache/cache-generation-clear.test.py
+++ b/tests/gold_tests/cache/cache-generation-clear.test.py
@@ -30,7 +30,6 @@ ts.Disk.records_config.update(
     {
         'proxy.config.body_factory.enable_customizations': 3,  # enable domain 
specific body factory
         'proxy.config.http.cache.generation': -1,  # Start with cache turned 
off
-        'proxy.config.config_update_interval_ms': 1,
     })
 
 ts.Disk.plugin_config.AddLine('xdebug.so 
--enable=x-cache,x-cache-key,via,x-cache-generation')
diff --git a/tests/gold_tests/cache/cache-generation-disjoint.test.py 
b/tests/gold_tests/cache/cache-generation-disjoint.test.py
index 9c01fa0505..d2adce9ca2 100644
--- a/tests/gold_tests/cache/cache-generation-disjoint.test.py
+++ b/tests/gold_tests/cache/cache-generation-disjoint.test.py
@@ -31,7 +31,6 @@ ts.Disk.records_config.update(
     {
         'proxy.config.body_factory.enable_customizations': 3,  # enable domain 
specific body factory
         'proxy.config.http.cache.generation': -1,  # Start with cache turned 
off
-        'proxy.config.config_update_interval_ms': 1,
     })
 ts.Disk.plugin_config.AddLine('xdebug.so 
--enable=x-cache,x-cache-key,via,x-cache-generation')
 ts.Disk.remap_config.AddLines(
diff --git a/tests/gold_tests/cache/disjoint-wait-for-cache.test.py 
b/tests/gold_tests/cache/disjoint-wait-for-cache.test.py
index 2570c6a0a0..c9377645d0 100644
--- a/tests/gold_tests/cache/disjoint-wait-for-cache.test.py
+++ b/tests/gold_tests/cache/disjoint-wait-for-cache.test.py
@@ -33,7 +33,6 @@ ts.Disk.records_config.update(
     {
         'proxy.config.body_factory.enable_customizations': 3,  # enable domain 
specific body factory
         'proxy.config.http.cache.generation': -1,  # Start with cache turned 
off
-        'proxy.config.config_update_interval_ms': 1,
         'proxy.config.http.wait_for_cache': 3,
     })
 ts.Disk.plugin_config.AddLine('xdebug.so 
--enable=x-cache,x-cache-key,via,x-cache-generation')
diff --git a/tests/gold_tests/tls/ssl_key_dialog.test.py 
b/tests/gold_tests/tls/ssl_key_dialog.test.py
index c1459e576f..dd9438f371 100644
--- a/tests/gold_tests/tls/ssl_key_dialog.test.py
+++ b/tests/gold_tests/tls/ssl_key_dialog.test.py
@@ -30,6 +30,7 @@ ts.addSSLfile("ssl/passphrase2.pem")
 ts.addSSLfile("ssl/passphrase2.key")
 
 ts.Disk.remap_config.AddLine(f"map https://passphrase:{ts.Variables.ssl_port}/ 
http://127.0.0.1:{server.Variables.Port}";)
+ts.Disk.remap_config.AddLine(f"map 
https://passphrase2:{ts.Variables.ssl_port}/ 
http://127.0.0.1:{server.Variables.Port}";)
 ts.Disk.records_config.update(
     {
         'proxy.config.diags.debug.enabled': 1,
@@ -83,10 +84,19 @@ tr2reload.Processes.Default.Command = 'traffic_ctl config 
reload'
 tr2reload.Processes.Default.Env = ts.Env
 tr2reload.Processes.Default.ReturnCode = 0
 
+tr2reload = Test.AddTestRun("Await config reload")
+p = tr2reload.Processes.Default
+p.Command = 'echo awaiting config reload'
+p.Env = ts.Env
+p.ReturnCode = 0
+await_config_reload = tr.Processes.Process(f'config_reload_succeeded', 'sleep 
30')
+await_config_reload.Ready = When.FileContains(ts.Disk.diags_log.Name, 
"ssl_multicert.config finished loading", 2)
+p.StartBefore(await_config_reload)
+
 tr3 = Test.AddTestRun("use a key with passphrase")
 tr3.Setup.Copy("ssl/signer.pem")
 tr3.MakeCurlCommand(
-    f"-v --cacert ./signer.pem  --resolve 
'passphrase:{ts.Variables.ssl_port}:127.0.0.1' 
https://passphrase:{ts.Variables.ssl_port}/";,
+    f"-v --cacert ./signer.pem  --resolve 
'passphrase2:{ts.Variables.ssl_port}:127.0.0.1' 
https://passphrase2:{ts.Variables.ssl_port}/";,
     ts=ts)
 tr3.ReturnCode = 0
 tr3.Processes.Default.Streams.stderr.Content = 
Testers.ContainsExpression("200", "expected 200 OK response")
diff --git a/tests/gold_tests/traffic_ctl/gold/diff.gold 
b/tests/gold_tests/traffic_ctl/gold/diff.gold
index ab50c4c93d..fefb2a60e6 100644
--- a/tests/gold_tests/traffic_ctl/gold/diff.gold
+++ b/tests/gold_tests/traffic_ctl/gold/diff.gold
@@ -1,3 +1,6 @@
+proxy.config.config_update_interval_ms has changed
+``Current Value: 20
+``Default Value: 3000
 proxy.config.diags.debug.enabled has changed
 ``Current Value: 1
 ``Default Value: 0
diff --git a/tests/gold_tests/traffic_ctl/gold/diff_yaml.gold 
b/tests/gold_tests/traffic_ctl/gold/diff_yaml.gold
index 5780dc4304..f41fb6c84a 100644
--- a/tests/gold_tests/traffic_ctl/gold/diff_yaml.gold
+++ b/tests/gold_tests/traffic_ctl/gold/diff_yaml.gold
@@ -1,4 +1,5 @@
 records:
+  config_update_interval_ms: 20  # default: 3000
   diags:
     debug:
       enabled: 1  # default: 0
diff --git a/tests/gold_tests/traffic_ctl/traffic_ctl_server_output.test.py 
b/tests/gold_tests/traffic_ctl/traffic_ctl_server_output.test.py
index 64574f2a2e..b42e29ebb5 100644
--- a/tests/gold_tests/traffic_ctl/traffic_ctl_server_output.test.py
+++ b/tests/gold_tests/traffic_ctl/traffic_ctl_server_output.test.py
@@ -41,14 +41,14 @@ traffic_ctl = Make_traffic_ctl(Test, records_yaml)
 ######
 # traffic_ctl server status
 traffic_ctl.server().status().validate_with_text(
-    '{"initialized_done": "true", "is_ssl_handshaking_stopped": "false", 
"is_draining": "false", "is_event_system_shut_down": "false", "thread_groups": 
[{"name": "ET_NET", "count": "4", "started": "true"}, {"name": "ET_TASK", 
"count": "2", "started": "true"}, {"name": "ET_UDP", "count": "0", "started": 
"false"}]}'
+    '{"initialized_done": "true", "is_ssl_handshaking_stopped": "false", 
"is_draining": "false", "is_event_system_shut_down": "false", "thread_groups": 
[{"name": "ET_NET", "count": "``", "started": "true"}, {"name": "ET_TASK", 
"count": "2", "started": "true"}, {"name": "ET_UDP", "count": "0", "started": 
"false"}]}'
 )
 # Drain ats so we can check the output.
 traffic_ctl.server().drain().exec()
 
 # After the drain, server status should reflect this change.
 traffic_ctl.server().status().validate_with_text(
-    '{"initialized_done": "true", "is_ssl_handshaking_stopped": "false", 
"is_draining": "true", "is_event_system_shut_down": "false", "thread_groups": 
[{"name": "ET_NET", "count": "4", "started": "true"}, {"name": "ET_TASK", 
"count": "2", "started": "true"}, {"name": "ET_UDP", "count": "0", "started": 
"false"}]}'
+    '{"initialized_done": "true", "is_ssl_handshaking_stopped": "false", 
"is_draining": "true", "is_event_system_shut_down": "false", "thread_groups": 
[{"name": "ET_NET", "count": "``", "started": "true"}, {"name": "ET_TASK", 
"count": "2", "started": "true"}, {"name": "ET_UDP", "count": "0", "started": 
"false"}]}'
 )
 
 # Get basic and empty connection tracker info.

Reply via email to