tribler icon indicating copy to clipboard operation
tribler copied to clipboard

Remove `DownloadManager.dummy_mode`

Open qstokkink opened this issue 1 year ago • 2 comments

In #7466 it was uncovered that dummy_mode of DownloadManager is uncovered.

The dummy_mode code being uncovered suggests that the corresponding code is dead code and can be removed. However, we should check that this is indeed the case.

If the code related to dummy_mode is indeed dead code, we can remove it.

qstokkink avatar Jan 04 '24 11:01 qstokkink

How the dummy_mode is used in our test infrastructure

The dummy_mode is equivalent to the gui_test_mode.

https://github.com/Tribler/tribler/blob/8c2f12c05de41e91fbf4bdf14dde55091381ef76/src/tribler/core/components/libtorrent/libtorrent_component.py#L30

The gui_test_mode is used in test_gui.py while performing GUI tests https://github.com/Tribler/tribler/blob/8c2f12c05de41e91fbf4bdf14dde55091381ef76/src/tribler/gui/tests/test_gui.py#L59

Therefore it is used in guitest workflow: https://github.com/Tribler/tribler/blob/main/.github/workflows/guitest.yml

What is the dummy_mode

The following lines are affected by dummy_mode: https://github.com/Tribler/tribler/blob/8c2f12c05de41e91fbf4bdf14dde55091381ef76/src/tribler/core/components/libtorrent/download_manager/download_manager.py#L128 https://github.com/Tribler/tribler/blob/8c2f12c05de41e91fbf4bdf14dde55091381ef76/src/tribler/core/components/libtorrent/download_manager/download_manager.py#L198-L205 https://github.com/Tribler/tribler/blob/8c2f12c05de41e91fbf4bdf14dde55091381ef76/src/tribler/core/components/libtorrent/download_manager/download_manager.py#L252-L259 https://github.com/Tribler/tribler/blob/8c2f12c05de41e91fbf4bdf14dde55091381ef76/src/tribler/core/components/libtorrent/download_manager/download_manager.py#L324-L328 https://github.com/Tribler/tribler/blob/8c2f12c05de41e91fbf4bdf14dde55091381ef76/src/tribler/core/components/libtorrent/download_manager/download_manager.py#L634-L636 https://github.com/Tribler/tribler/blob/8c2f12c05de41e91fbf4bdf14dde55091381ef76/src/tribler/core/components/libtorrent/download_manager/download.py#L112

drew2a avatar Jan 04 '24 12:01 drew2a

Working from the results of this analysis, I think dummy_mode should be removed because it is only used for tests. My reasoning is that the system under test is changing its behavior to fit the tests. Instead, the tests should configure the system to test certain behavior.

qstokkink avatar Jan 04 '24 12:01 qstokkink

This appears to have been resolved in #7466

qstokkink avatar Aug 12 '24 14:08 qstokkink