Skip to content

Commit 713cf2e

Browse files
authored
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.
1 parent 756deef commit 713cf2e

8 files changed

Lines changed: 25 additions & 11 deletions

File tree

tests/gold_tests/autest-site/trafficserver.test.ext

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ def MakeATSProcess(
383383
'proxy.config.ssl.keylog_file': tmpname,
384384
})
385385

386+
# For config reload tests, no need to wait the default 3 seconds to detect the need for a reload.
387+
p.Disk.records_config.update({'proxy.config.config_update_interval_ms': 20})
388+
386389
if enable_cache:
387390
# In records.yaml, the cache is enabled by default so there's nothing
388391
# we have to do here to functionally enable it. However, the tests that
@@ -557,16 +560,17 @@ class YAMLFile(File):
557560
else:
558561
return content # Already an object.
559562

560-
def __update(self, content, out):
563+
def __update(self, content: dict, out: dict):
561564
for key, value in content.items():
562565
if key in out:
563-
if isinstance(out[key], dict) == False:
564-
out.update(content)
566+
if not isinstance(out[key], dict):
567+
# Simple: just set the value.
568+
out[key] = value
565569
continue
566570

571+
# Recurse: update the nested dictionary.
567572
self.__update(value, out[key])
568573
else:
569-
out[key] = {}
570574
out[key] = value
571575

572576
def update(self, content):
@@ -602,7 +606,6 @@ class RecordsYAML(YAMLFile):
602606
def __legacy_update(self, obj, new_doc=False):
603607
config = {}
604608
for name, value in obj.items():
605-
ori_name = name
606609
if name.startswith("proxy.config."):
607610
name = name[len("proxy.config."):]
608611
elif name.startswith("local.config."):

tests/gold_tests/cache/cache-generation-clear.test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
{
3131
'proxy.config.body_factory.enable_customizations': 3, # enable domain specific body factory
3232
'proxy.config.http.cache.generation': -1, # Start with cache turned off
33-
'proxy.config.config_update_interval_ms': 1,
3433
})
3534

3635
ts.Disk.plugin_config.AddLine('xdebug.so --enable=x-cache,x-cache-key,via,x-cache-generation')

tests/gold_tests/cache/cache-generation-disjoint.test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
{
3232
'proxy.config.body_factory.enable_customizations': 3, # enable domain specific body factory
3333
'proxy.config.http.cache.generation': -1, # Start with cache turned off
34-
'proxy.config.config_update_interval_ms': 1,
3534
})
3635
ts.Disk.plugin_config.AddLine('xdebug.so --enable=x-cache,x-cache-key,via,x-cache-generation')
3736
ts.Disk.remap_config.AddLines(

tests/gold_tests/cache/disjoint-wait-for-cache.test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
{
3434
'proxy.config.body_factory.enable_customizations': 3, # enable domain specific body factory
3535
'proxy.config.http.cache.generation': -1, # Start with cache turned off
36-
'proxy.config.config_update_interval_ms': 1,
3736
'proxy.config.http.wait_for_cache': 3,
3837
})
3938
ts.Disk.plugin_config.AddLine('xdebug.so --enable=x-cache,x-cache-key,via,x-cache-generation')

tests/gold_tests/tls/ssl_key_dialog.test.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
ts.addSSLfile("ssl/passphrase2.key")
3131

3232
ts.Disk.remap_config.AddLine(f"map https://passphrase:{ts.Variables.ssl_port}/ http://127.0.0.1:{server.Variables.Port}")
33+
ts.Disk.remap_config.AddLine(f"map https://passphrase2:{ts.Variables.ssl_port}/ http://127.0.0.1:{server.Variables.Port}")
3334
ts.Disk.records_config.update(
3435
{
3536
'proxy.config.diags.debug.enabled': 1,
@@ -83,10 +84,19 @@
8384
tr2reload.Processes.Default.Env = ts.Env
8485
tr2reload.Processes.Default.ReturnCode = 0
8586

87+
tr2reload = Test.AddTestRun("Await config reload")
88+
p = tr2reload.Processes.Default
89+
p.Command = 'echo awaiting config reload'
90+
p.Env = ts.Env
91+
p.ReturnCode = 0
92+
await_config_reload = tr.Processes.Process(f'config_reload_succeeded', 'sleep 30')
93+
await_config_reload.Ready = When.FileContains(ts.Disk.diags_log.Name, "ssl_multicert.config finished loading", 2)
94+
p.StartBefore(await_config_reload)
95+
8696
tr3 = Test.AddTestRun("use a key with passphrase")
8797
tr3.Setup.Copy("ssl/signer.pem")
8898
tr3.MakeCurlCommand(
89-
f"-v --cacert ./signer.pem --resolve 'passphrase:{ts.Variables.ssl_port}:127.0.0.1' https://passphrase:{ts.Variables.ssl_port}/",
99+
f"-v --cacert ./signer.pem --resolve 'passphrase2:{ts.Variables.ssl_port}:127.0.0.1' https://passphrase2:{ts.Variables.ssl_port}/",
90100
ts=ts)
91101
tr3.ReturnCode = 0
92102
tr3.Processes.Default.Streams.stderr.Content = Testers.ContainsExpression("200", "expected 200 OK response")

tests/gold_tests/traffic_ctl/gold/diff.gold

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
proxy.config.config_update_interval_ms has changed
2+
``Current Value: 20
3+
``Default Value: 3000
14
proxy.config.diags.debug.enabled has changed
25
``Current Value: 1
36
``Default Value: 0

tests/gold_tests/traffic_ctl/gold/diff_yaml.gold

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
records:
2+
config_update_interval_ms: 20 # default: 3000
23
diags:
34
debug:
45
enabled: 1 # default: 0

tests/gold_tests/traffic_ctl/traffic_ctl_server_output.test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
######
4242
# traffic_ctl server status
4343
traffic_ctl.server().status().validate_with_text(
44-
'{"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"}]}'
44+
'{"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"}]}'
4545
)
4646
# Drain ats so we can check the output.
4747
traffic_ctl.server().drain().exec()
4848

4949
# After the drain, server status should reflect this change.
5050
traffic_ctl.server().status().validate_with_text(
51-
'{"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"}]}'
51+
'{"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"}]}'
5252
)
5353

5454
# Get basic and empty connection tracker info.

0 commit comments

Comments
 (0)