tests: remove isdir/isfile asserts from lttng_live_server.py
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 17 Oct 2023 18:51:39 +0000 (14:51 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 20 Oct 2023 23:29:14 +0000 (19:29 -0400)
commit4b8b3b25c442df3ac0074e75ea0cd84ae915dfbe
treed4a04118fff0b6f881edcde068403712dc5363b6
parente46b84621c9b478ea60be63dd4492aa7ac5b0510
tests: remove isdir/isfile asserts from lttng_live_server.py

When lttng_live_server.py receives a trace path that doesn't exist
(perhaps because the user forgot to pass a --trace-path-prefix), it
gives:

    Traceback (most recent call last):
      File "lttng_live_server.py", line 1969, in <module>
        trace_path_prefix,
      File "lttng_live_server.py", line 1892, in _session_descriptors_from_path
        traces.append(LttngTrace(path, metadata_sections, beacons))
      File "lttng_live_server.py", line 1044, in __init__
        assert os.path.isdir(trace_dir)
    AssertionError

This is not very helpful, it hides details about the nature of the
problem.  Remove the assert, and let the subsequent open fail, saying
why it failed.  After the patch, it becomes:

    Traceback (most recent call last):
      File "lttng_live_server.py", line 1968, in <module>
trace_path_prefix,
      File "lttng_live_server.py", line 1891, in _session_descriptors_from_path
traces.append(LttngTrace(path, metadata_sections, beacons))
      File "lttng_live_server.py", line 1045, in __init__
self._create_metadata_stream(trace_dir, metadata_sections)
      File "lttng_live_server.py", line 1099, in _create_metadata_stream
metadata_path, config_metadata_sections
      File "lttng_live_server.py", line 974, in _split_metadata_sections
with open(metadata_file_path, "r") as metadata_file:
    FileNotFoundError: [Errno 2] No such file or directory: 'live/split_metadata/metadata'

Remove an isfile assert for the same reason.

Change-Id: If4289515b2c27748dd90209049c623e02c940a03
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/10899
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py
This page took 0.024193 seconds and 4 git commands to generate.