Git Product home page Git Product logo

Comments (2)

drew2a avatar drew2a commented on May 26, 2024

How the dummy_mode is used in our test infrastructure

The dummy_mode is equivalent to the gui_test_mode.

The gui_test_mode is used in test_gui.py while performing GUI tests

core_args=[str(RUN_TRIBLER_PY.absolute()), '--core', '--gui-test-mode'],

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:

self.dht_readiness_timeout = self.config.dht_readiness_timeout if not self.dummy_mode else 0

# If libtorrent session has pending disk io, wait until timeout (default: 30 seconds) to let it finish.
# In between ask for session stats to check if state is clean for shutdown.
# In dummy mode, we immediately shut down the download manager.
while not self.dummy_mode and not self.is_shutdown_ready() and timeout >= 1:
self.notify_shutdown_state("Waiting for LibTorrent to finish...")
self.post_session_stats()
timeout -= 1
await asyncio.sleep(1)

if self.dummy_mode:
from unittest.mock import Mock
ltsession = Mock()
ltsession.pop_alerts = lambda: {}
ltsession.listen_port = lambda: 123
ltsession.get_settings = lambda: {"peer_fingerprint": "000"}
else:
ltsession = lt.session(lt.fingerprint(*fingerprint), flags=0) if hops == 0 else lt.session(flags=0)

if self.config.dht and not self.dummy_mode:
ltsession.start_dht()
for router in DEFAULT_DHT_ROUTERS:
ltsession.add_dht_router(*router)
ltsession.start_lsd()

if not self.dummy_mode:
self._logger.info('Dummy mode is disabled. Starting handle.')
await self.start_handle(download, atp)

self.checkpoint_disabled = checkpoint_disabled or self.dummy

from tribler.

qstokkink avatar qstokkink commented on May 26, 2024

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.

from tribler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.