Skip to content

lttngpy test_session.py assumes that no other tracing sessions exist #200

@christophebedard

Description

@christophebedard

Generated by Generative AI

No response

Operating System:

<PUT OS INFO HERE>

ROS version or commit hash:

rolling

RMW implementation (if applicable):

No response

RMW Configuration (if applicable):

No response

Client library (if applicable):

No response

'ros2 doctor --report' output

ros2 doctor --report
<COPY OUTPUT HERE>

Steps to reproduce issue

https://github.com/ros2/ros2_tracing/blob/e175cde407a2da7fab2a75890cdb9d0e626cc73b/lttngpy/test/test_session.py

Tests in the file above assume that no sessions other than the one(s) being created during the tests exist. These tests fail if other tracing tests run in parallel (and create tracing sessions).

This is evident if one creates a dummy sesison (lttng create mysession) before running lttngpy tests.

Expected behavior

Test(s) pass.

Actual behavior

Tests fail:

5: ../../src/ros2/ros2_tracing/lttngpy/test/test_session.py FF              [100%]
5: 
5: =================================== FAILURES ===================================
5: ____________________________ TestSession.test_error ____________________________
5: 
5: self = <test_session.TestSession testMethod=test_error>
5: 
5:     def test_error(self):
5:         session_name = 'test_error'
5: >       self.assertSetEqual(set(), lttngpy.get_session_names())
5: E       AssertionError: Items in the second set but not the first:
5: E       'mysession'
5: 
5: ../../src/ros2/ros2_tracing/lttngpy/test/test_session.py:64: AssertionError
5: ___________ TestSession.test_session_list_create_start_stop_destroy ____________
5: 
5: self = <test_session.TestSession testMethod=test_session_list_create_start_stop_destroy>
5: 
5:     def test_session_list_create_start_stop_destroy(self):
5:         session_name = 'test_session_list_create_start_stop_destroy'
5:         tmpdir = self.create_test_tmpdir(session_name)
5:     
5: >       self.assertSetEqual(set(), lttngpy.get_session_names())
5: E       AssertionError: Items in the second set but not the first:
5: E       'mysession'
5: 
5: ../../src/ros2/ros2_tracing/lttngpy/test/test_session.py:33: AssertionError
5: - generated xml file: /home/christophe.bedard/ros2_ws/build/lttngpy/test_results/lttngpy/test_session.xunit.xml -
5: =========================== short test summary info ============================
5: FAILED ../../src/ros2/ros2_tracing/lttngpy/test/test_session.py::TestSession::test_error
5: FAILED ../../src/ros2/ros2_tracing/lttngpy/test/test_session.py::TestSession::test_session_list_create_start_stop_destroy
5: ============================== 2 failed in 0.03s ===============================

Additional information

The tests shouldn't do simple things like self.assertSetEqual(set(), lttngpy.get_session_names()).

They should either:

  1. Only check for the presence/absence of that test's tracing session; or
  2. Figure out how to partition LTTng/the session daemon so that the test is fully isolated from (and doesn't see) other tests' tracing sessions.

Option 1 is probably simpler for now.

Some other tests might also do this.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions