Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions tests/gold_tests/autest-site/trafficserver.test.ext
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ default_log_data = {

def MakeATSProcess(obj, name, command='traffic_server', select_ports=True,
enable_tls=False, enable_cache=True, enable_quic=False,
block_for_debug=False, log_data=default_log_data):
block_for_debug=False, log_data=default_log_data,
use_traffic_out=True):
#####################################
# common locations

Expand Down Expand Up @@ -71,13 +72,28 @@ def MakeATSProcess(obj, name, command='traffic_server', select_ports=True,
storage_dir = os.path.join(ts_dir, 'storage')
cache_dir = os.path.join(ts_dir, 'cache')

ts_args = ''
if use_traffic_out:
# Bind stdout/err to traffic.out. This allows tests to wait upon
# content from the traffic.out file, something that cannot be done on
# process stdout/stderr in AuTest.
traffic_out = os.path.join(log_dir, 'traffic.out')
ts_args += f' --bind_stderr {traffic_out}'
ts_args += f' --bind_stdout {traffic_out}'

if block_for_debug:
if command.startswith('traffic_server'):
command += ' --block'
elif command.startswith('traffic_manager'):
if '--tsArgs' not in command:
command += ' --tsArgs'
command += ' --block'
ts_args += ' --block'

if 'traffic_manager' in command:
if '--tsArgs' in command:
# None of our tests do this, but if we eventually pass in --tsArgs
# at some point from a test, we'll need to figure out how to mix
# that with the arguments we're assembling for --tsArgs here.
host.WriteError('Do not know how to assemble --tsArgs.')
if ts_args:
command += f' --tsArgs "{ts_args}"'
elif 'traffic_server' in command:
command += ts_args

# create process
p = obj.Processes.Process(name, command)
Expand Down Expand Up @@ -220,7 +236,12 @@ def MakeATSProcess(obj, name, command='traffic_server', select_ports=True,
"Unrecognized configuration value",
f"Diags log file {fname} should not contain a warning about an unrecognized configuration")

if command == "traffic_manager":
# traffic.out
fname = "traffic.out"
tmpname = os.path.join(log_dir, fname)
p.Disk.File(tmpname, id='traffic_out')

if "traffic_manager" in command:
fname = log_data['manager']
if fname == 'stdout':
p.Disk.manager_log = p.Streams.stdout
Expand Down Expand Up @@ -364,7 +385,7 @@ def MakeATSProcess(obj, name, command='traffic_server', select_ports=True,
p.Env['PROXY_CONFIG_ADMIN_AUTOCONF_PORT'] = str(
p.Variables.admin_port) # support pre ATS 6.x

if command == "traffic_manager":
if 'traffic_manager' in command:
p.ReturnCode = 2
else:
p.ReturnCode = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def setupTS(self):
self.ts.Disk.remap_config.AddLine(
f"map / http://127.0.0.1:{self.server.Variables.http_port}/",
)
self.ts.Streams.stderr += Testers.ContainsExpression(
self.ts.Disk.traffic_out.Content += Testers.ContainsExpression(
"user agent post chunk decoding error",
"Verify that ATS detected a problem parsing a chunk.")

Expand Down
4 changes: 2 additions & 2 deletions tests/gold_tests/cont_schedule/schedule.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
tr.Processes.Default.Command = 'printf "Test TSContSchedule API"'
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
ts.Streams.All = "gold/schedule.gold"
ts.Streams.All += Testers.ExcludesExpression('fail', 'should not contain "fail"')
ts.Disk.traffic_out.Content = "gold/schedule.gold"
ts.Disk.traffic_out.Content += Testers.ExcludesExpression('fail', 'should not contain "fail"')
4 changes: 2 additions & 2 deletions tests/gold_tests/cont_schedule/schedule_on_pool.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
tr.Processes.Default.Command = 'printf "Test TSContScheduleOnPool API"'
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
ts.Streams.All = "gold/schedule_on_pool.gold"
ts.Streams.All += Testers.ExcludesExpression('fail', 'should not contain "fail"')
ts.Disk.traffic_out.Content = "gold/schedule_on_pool.gold"
ts.Disk.traffic_out.Content += Testers.ExcludesExpression('fail', 'should not contain "fail"')
4 changes: 2 additions & 2 deletions tests/gold_tests/cont_schedule/schedule_on_thread.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
tr.Processes.Default.Command = 'printf "Test TSContScheduleOnThread API"'
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
ts.Streams.All = "gold/schedule_on_thread.gold"
ts.Streams.All += Testers.ExcludesExpression('fail', 'should not contain "fail"')
ts.Disk.traffic_out.Content = "gold/schedule_on_thread.gold"
ts.Disk.traffic_out.Content += Testers.ExcludesExpression('fail', 'should not contain "fail"')
4 changes: 2 additions & 2 deletions tests/gold_tests/cont_schedule/thread_affinity.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
tr.Processes.Default.Command = 'printf "Test TSContThreadAffinity API"'
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(ts)
ts.Streams.All = "gold/thread_affinity.gold"
ts.Streams.All += Testers.ExcludesExpression('fail', 'should not contain "fail"')
ts.Disk.traffic_out.Content = "gold/thread_affinity.gold"
ts.Disk.traffic_out.Content += Testers.ExcludesExpression('fail', 'should not contain "fail"')
2 changes: 1 addition & 1 deletion tests/gold_tests/continuations/session_id.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ def verify_session_count(output):
return ""


ts.Streams.All += Testers.FileContentCallback(verify_session_count, 'verify_session_count')
ts.Disk.traffic_out.Content += Testers.FileContentCallback(verify_session_count, 'verify_session_count')
2 changes: 1 addition & 1 deletion tests/gold_tests/h2/nghttp.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@
tr.StillRunningAfter = httpbin
tr.StillRunningAfter = ts

ts.Streams.stderr = "gold/nghttp_ts_stderr.gold"
ts.Disk.traffic_out.Content = "gold/nghttp_ts_stderr.gold"
4 changes: 2 additions & 2 deletions tests/gold_tests/ip_allow/ip_allow.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@
'''.split("\n")
)

ts.Streams.stderr += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
"Line 1 denial for 'CONNECT' from 127.0.0.1",
"The CONNECT request should be denied by ip_allow")
ts.Streams.stderr += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
"Line 1 denial for 'PUSH' from 127.0.0.1",
"The PUSH request should be denied by ip_allow")

Expand Down
8 changes: 4 additions & 4 deletions tests/gold_tests/logging/log-debug-client-ip.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@

# Verify that the various aspects of the expected debug output for the
# transaction are logged.
ts.Streams.stderr = Testers.ContainsExpression(
ts.Disk.traffic_out.Content = Testers.ContainsExpression(
r"\+ Incoming Request \+",
"Make sure the client request information is present.")
ts.Streams.stderr += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
r"\+ Proxy's Request after hooks \+",
"Make sure the proxy request information is present.")
ts.Streams.stderr += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
r"\+ Incoming O.S. Response \+",
"Make sure the server's response information is present.")
ts.Streams.stderr += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
r"\+ Proxy's Response 2 \+",
"Make sure the proxy response information is present.")

Expand Down
2 changes: 1 addition & 1 deletion tests/gold_tests/logging/log-filenames.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __configure_traffic_manager(self, log_data):
self._ts_name = f"ts{LogFilenamesTest.__ts_counter}"
LogFilenamesTest.__ts_counter += 1
self.ts = Test.MakeATSProcess(self._ts_name, command="traffic_manager",
log_data=log_data)
use_traffic_out=False, log_data=log_data)
self.ts.Disk.records_config.update({
'proxy.config.diags.debug.enabled': 0,
'proxy.config.diags.debug.tags': 'log',
Expand Down
14 changes: 7 additions & 7 deletions tests/gold_tests/logging/log_pipe.test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ def get_ts(logging_config):

pipe_path = os.path.join(ts.Variables.LOGDIR, pipe_name)

ts.Streams.All += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
"Created named pipe .*{}".format(pipe_name),
"Verify that the named pipe was created")

ts.Streams.All += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
"no readers for pipe .*{}".format(pipe_name),
"Verify that no readers for the pipe was detected.")

ts.Streams.All += Testers.ExcludesExpression(
ts.Disk.traffic_out.Content += Testers.ExcludesExpression(
"New buffer size for pipe".format(pipe_name),
"Verify that the default pipe size was used.")

Expand Down Expand Up @@ -136,15 +136,15 @@ def get_ts(logging_config):

pipe_path = os.path.join(ts.Variables.LOGDIR, pipe_name)

ts.Streams.All += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
"Created named pipe .*{}".format(pipe_name),
"Verify that the named pipe was created")

ts.Streams.All += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
"no readers for pipe .*{}".format(pipe_name),
"Verify that no readers for the pipe was detected.")

ts.Streams.All += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
"Previous buffer size for pipe .*{}".format(pipe_name),
"Verify that the named pipe's size was adjusted")

Expand All @@ -156,7 +156,7 @@ def get_ts(logging_config):
# requested, but it should be at least that big. We use the
# pipe_buffer_is_larger_than.py helper script to verify that the pipe grew in
# size.
ts.Streams.All += Testers.ContainsExpression(
ts.Disk.traffic_out.Content += Testers.ContainsExpression(
"New buffer size for pipe.*{}".format(pipe_name),
"Verify that the named pipe's size was adjusted")
buffer_verifier = "pipe_buffer_is_larger_than.py"
Expand Down
Loading