Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added (disabled) composition integration test #8439

Merged
merged 5 commits into from
Feb 14, 2025

Conversation

qstokkink
Copy link
Contributor

@qstokkink qstokkink commented Feb 14, 2025

This PR:

  • Adds an integration test to check all possible user configurations.
  • Fixes the TorrentCheckerComponent assuming that the database is always available.
  • Fixes the TriblerTunnelCommunity not get the ltsession async in update_ip_filter.
  • Fixes test_stream using AsyncMock for update_priorities (should be Mock).
  • Fixes test_download_manager not mocking downloads correctly in two tests.

The last three fixes were not intended, but I discovered them while trying to work out that GitHub Actions "segfaults" the integration tests when using unittest.skip.

@qstokkink qstokkink force-pushed the add_composition_integtest branch from 85c7f12 to 6cda472 Compare February 14, 2025 12:18
@qstokkink
Copy link
Contributor Author

qstokkink commented Feb 14, 2025

While debugging mysterious GitHub Action failure, found:
Exception occurred while handling packet!
Traceback (most recent call last):
  File "tribler/pyipv8/ipv8/messaging/anonymization/community.py", line 722, in on_packet_from_circuit
    result = handler(source_address, data, circuit_id)
  File "tribler/src/tribler/core/tunnel/community.py", line 360, in on_rendezvous_established
    self.update_ip_filter(circuit.info_hash)
  File "tribler/src/tribler/core/tunnel/community.py", line 371, in update_ip_filter
    self.settings.download_manager.update_ip_filter(lt_session, ip_addresses)
  File "tribler/src/tribler/core/libtorrent/download_manager/download_manager.py", line 533, in update_ip_filter
    lt_session.set_ip_filter(ip_filter)
AttributeError: '_asyncio.Future' object has no attribute 'set_ip_filter'
Traceback (most recent call last):
  File "tribler/pyipv8/ipv8/messaging/anonymization/community.py", line 722, in on_packet_from_circuit
    result = handler(source_address, data, circuit_id)
  File "tribler/src/tribler/core/tunnel/community.py", line 360, in on_rendezvous_established
    self.update_ip_filter(circuit.info_hash)
  File "tribler/src/tribler/core/tunnel/community.py", line 371, in update_ip_filter
    self.settings.download_manager.update_ip_filter(lt_session, ip_addresses)
  File "tribler/src/tribler/core/libtorrent/download_manager/download_manager.py", line 533, in update_ip_filter
    lt_session.set_ip_filter(ip_filter)
AttributeError: '_asyncio.Future' object has no attribute 'set_ip_filter'

Fixed in this PR

@qstokkink qstokkink force-pushed the add_composition_integtest branch from 6cda472 to e1725d0 Compare February 14, 2025 12:38
@qstokkink
Copy link
Contributor Author

qstokkink commented Feb 14, 2025

Found another in output:
 /home/runner/work/tribler/tribler/src/tribler/core/libtorrent/download_manager/stream.py:282: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
Coroutine created at (most recent call last)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/asyncio/base_events.py", line 1901, in _run_once
    handle._run()
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/async_case.py", line 101, in _asyncioLoopRunner
    ret = await awaitable
  File "/home/runner/work/tribler/tribler/src/tribler/test_unit/core/libtorrent/download_manager/test_stream.py", line 118, in test_read_multiple_pieces
    streamed += await self.chunk.read()
  File "/home/runner/work/tribler/tribler/src/tribler/core/libtorrent/download_manager/stream.py", line 297, in read
    await self.seek(self.seek_offset)
  File "/home/runner/work/tribler/tribler/src/tribler/core/libtorrent/download_manager/stream.py", line 282, in seek
    self.stream.update_priorities()
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/mock.py", line 1114, in __call__
    return self._mock_call(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/mock.py", line 1118, in _mock_call
    return self._execute_mock_call(*args, **kwargs)
  self.stream.update_priorities()
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Fixed in this PR

@qstokkink qstokkink force-pushed the add_composition_integtest branch 2 times, most recently from d94853b to e7ab5a5 Compare February 14, 2025 13:06
@qstokkink qstokkink force-pushed the add_composition_integtest branch from e7ab5a5 to 9dd0cb7 Compare February 14, 2025 13:08
@qstokkink
Copy link
Contributor Author

qstokkink commented Feb 14, 2025

Still not entirely sure why validate is failing on the Action, found another traceback:
/home/runner/work/tribler/tribler/src/tribler/core/libtorrent/download_manager/download_manager.py:660: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
Coroutine created at (most recent call last)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/case.py", line 591, in run
    self._callTestMethod(testMethod)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/async_case.py", line 64, in _callTestMethod
    self._callMaybeAsync(method)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/async_case.py", line 87, in _callMaybeAsync
    return self._asyncioTestLoop.run_until_complete(fut)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/asyncio/base_events.py", line 1901, in _run_once
    handle._run()
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/runner/work/tribler/tribler/src/tribler/core/libtorrent/download_manager/download_manager.py", line 660, in add_helpers_later
    download.add_trackers([t.encode() for t in params.trackers])
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/mock.py", line 1114, in __call__
    return self._mock_call(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/unittest/mock.py", line 1118, in _mock_call
    return self._execute_mock_call(*args, **kwargs)
  download.add_trackers([t.encode() for t in params.trackers])
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Fixed in this PR

@qstokkink
Copy link
Contributor Author

😑 ok, so, apparently the GitHub Actions running REALLY doesn't like unittest.skip.

@qstokkink qstokkink force-pushed the add_composition_integtest branch from 4676914 to c1301ae Compare February 14, 2025 13:35
@qstokkink
Copy link
Contributor Author

validate

@qstokkink qstokkink changed the title WIP: Added (disabled) composition integration test READY: Added (disabled) composition integration test Feb 14, 2025
@qstokkink qstokkink marked this pull request as ready for review February 14, 2025 13:42
@qstokkink qstokkink changed the title READY: Added (disabled) composition integration test Added (disabled) composition integration test Feb 14, 2025
@qstokkink qstokkink merged commit c3de6ae into Tribler:main Feb 14, 2025
7 checks passed
@qstokkink qstokkink deleted the add_composition_integtest branch February 14, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants