Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.74k stars 445 forks source link

Remove `DownloadManager.dummy_mode` #7797

Open qstokkink opened 6 months ago

qstokkink commented 6 months ago

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.

drew2a commented 6 months ago

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

qstokkink commented 6 months ago

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.