tests: fix all basic type check issues of lttng_live_server.py
[babeltrace.git] / tests / data / plugins / src.ctf.lttng-live / lttng_live_server.py
index 102f7ee85169b47806c3bcca55aeb45c17442e3e..9687929418490c87514e0f71b0028d0c1555f5ba 100644 (file)
@@ -761,6 +761,11 @@ class _LttngDataStream:
         self._path = path
         filename = os.path.basename(path)
         match = re.match(r"(.*)_\d+", filename)
+        if not match:
+            raise RuntimeError(
+                "Unexpected data stream file name pattern: {}".format(filename)
+            )
+
         self._channel_name = match.group(1)
         trace_dir = os.path.dirname(path)
         index_path = os.path.join(trace_dir, "index", filename + ".idx")
@@ -854,6 +859,12 @@ def _parse_metadata_sections_config(config_sections):
             line = config_section.get("line")
             ts = config_section.get("timestamp")
 
+            if type(line) is not int:
+                raise RuntimeError("`line` is not an integer")
+
+            if type(ts) is not int:
+                raise RuntimeError("`timestamp` is not an integer")
+
             # Sections' timestamps and lines must both be increasing.
             assert ts > last_timestamp
             last_timestamp = ts
@@ -1076,10 +1087,6 @@ class _LttngLiveViewerSessionMetadataStreamState:
             )
         )
 
-    @property
-    def trace_session_state(self):
-        return self._trace_session_state
-
     @property
     def info(self):
         return self._info
@@ -1435,6 +1442,7 @@ class _LttngLiveViewerSession:
         metadata_stream_state.is_sent = True
         status = _LttngLiveViewerGetMetadataStreamDataContentReply.Status.OK
         metadata_section = metadata_stream_state.cur_section
+        assert metadata_section is not None
 
         # If we are sending an empty section, ready the next one right away.
         if len(metadata_section.data) == 0:
This page took 0.023328 seconds and 4 git commands to generate.