Skip to content

Commit 3a1136d

Browse files
authored
tests(integ): add more debug logging (#5363)
1 parent 425247d commit 3a1136d

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

tests/integrationv2/fixtures.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def _fn(
6666
p = ManagedProcess(
6767
cmd_line,
6868
provider.set_provider_ready,
69+
name=provider.get_name(cmd_line),
6970
wait_for_marker=provider.ready_to_test_marker,
7071
send_marker_list=provider.ready_to_send_input_marker,
7172
close_marker=close_marker,

tests/integrationv2/processes.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ def _communicate(
116116
send_with_newline=False,
117117
timeout=None,
118118
):
119+
print(
120+
f"{self.name}: Handling process IO: \n"
121+
f" wait_for_marker: {self.wait_for_marker} \n"
122+
f" send_markers: {send_marker_list} \n"
123+
f" close_marker: {close_marker} \n"
124+
f" kill_marker: {kill_marker}"
125+
)
126+
119127
"""
120128
This method will read and write data to a subprocess in a non-blocking manner.
121129
The code is heavily based on Popen.communicate. There are a couple differences:
@@ -304,7 +312,7 @@ def _communicate(
304312
if close_marker is None or (
305313
close_marker and close_marker in data_str
306314
):
307-
print(f"{self.name} Found close marker: closing stdin")
315+
print(f"{self.name}: Found close marker: closing stdin")
308316
input_data_sent = None
309317
self.proc.stdin.close()
310318

@@ -358,6 +366,7 @@ def __init__(
358366
self,
359367
cmd_line,
360368
provider_set_ready_condition,
369+
name,
361370
wait_for_marker=None,
362371
send_marker_list=None,
363372
close_marker=None,
@@ -380,6 +389,8 @@ def __init__(
380389
# Command line to execute in the subprocess
381390
self.cmd_line = list(map(str, cmd_line))
382391

392+
self.name = name
393+
383394
# Total time to wait until killing the subprocess
384395
self.timeout = timeout
385396

@@ -426,7 +437,7 @@ def run(self):
426437
self.results = Results(None, None, None, ex, self.expect_stderr)
427438
raise ex
428439

429-
communicator = _processCommunicator(proc, self.cmd_line[0])
440+
communicator = _processCommunicator(proc, self.name)
430441

431442
if self.ready_to_test is not None:
432443
# Some processes won't be ready until they have emitted some string in stdout.
@@ -454,10 +465,12 @@ def run(self):
454465
expect_nonzero_exit=self.kill_marker is not None,
455466
)
456467
except subprocess.TimeoutExpired as ex:
468+
print(f"{communicator.name}: TIMEOUT. Killing process.")
457469
proc.kill()
458470
wrapped_ex = TimeoutException(ex)
459471

460472
# Read any remaining output
473+
print(f"{communicator.name}: TIMEOUT. Reading remaining output.")
461474
proc_results = communicator.communicate()
462475
self.results = Results(
463476
proc_results[0],

tests/integrationv2/providers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ def set_provider_ready(self):
106106
def supports_certificate(cls, cert: Cert):
107107
return True
108108

109+
@classmethod
110+
def get_name(cls, cmd_line):
111+
return cmd_line[0]
112+
109113

110114
class Tcpdump(Provider):
111115
"""
@@ -595,6 +599,10 @@ def setup_server(self):
595599

596600
return cmd_line
597601

602+
@classmethod
603+
def get_name(cls, cmd_line):
604+
return cmd_line[1]
605+
598606

599607
class SSLv3Provider(OpenSSL):
600608
def __init__(self, options: ProviderOptions):

0 commit comments

Comments
 (0)