AT: support for tshark tracing in CI
GitOrigin-RevId:
@@ -64,16 +64,26 @@ class Compose(object):
out_p = plumbum.local.path(out_dir)
cmd.mkdir("-p", out_p)
for svc in self("config", "--services").splitlines():
+ # Collect logs.
dst_f = out_p / "%s.log" % svc
with open(dst_f, "w") as log_file:
cmd.docker.run(args=("logs", svc), stdout=log_file,
stderr=subprocess.STDOUT, retcode=None)
+ # Collect coredupms.
coredump_f = out_p / "%s.coredump" % svc
try:
cmd.docker.run(args=("cp", svc+":/share/coredump", coredump_f))
except Exception:
# If the coredump does not exist, do nothing.
pass
+ # Collect tshark traces.
+ try:
+ cmd.docker.run(args=("cp", svc+":/share/tshark", out_p))
+ cmd.mv(out_p / "tshark" // "*", out_p)
+ cmd.rmdir(out_p / "tshark")
+ except Exception:
+ # If there are no tshark captures, do nothing.
+ pass
class _Network(NamedTuple):
