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

Fix the get_torrent_health endpoint in GUI tests #7505

Merged
merged 1 commit into from
Jun 26, 2023

Conversation

kozlovsky
Copy link
Collaborator

Currently, the RESTComponent.run method has the following code lines:

        torrent_checker = None if config.gui_test_mode else torrent_checker_component.torrent_checker
        tunnel_community = None if config.gui_test_mode else tunnel_component.community
        gigachannel_manager = None if config.gui_test_mode else gigachannel_manager_component.gigachannel_manager

and

        self.maybe_add('/metadata', MetadataEndpoint, torrent_checker, metadata_store_component.mds,
                       knowledge_db=knowledge_component.knowledge_db,
                       tag_rules_processor=knowledge_component.rules_processor)

That is, under GUI tests, the torrent_checker argument of MetadataEndpoint can be None. The maybe_add call does not handle this situation, as it can only handle NoneComponent arguments and not the normal None values.

But, the MetadataEndpoint.get_torrent_health methods expect self.torrent_checker to be not-None.

For some reason, during GUI tests, the get_torrent_health endpoint can be randomly called in different GUI tests, provoking a Core exception and a test failure.

This PR fixes the get_torrent_health endpoint by handling the case when self.torrent_checker is None.

@kozlovsky kozlovsky requested a review from a team as a code owner June 26, 2023 12:40
@kozlovsky kozlovsky requested review from drew2a and removed request for a team June 26, 2023 12:40
@drew2a
Copy link
Collaborator

drew2a commented Jun 26, 2023

Related to #7498

@kozlovsky kozlovsky merged commit 9d8bf67 into Tribler:release/7.13 Jun 26, 2023
16 checks passed
@kozlovsky kozlovsky deleted the fix/get_torrent_health branch June 26, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants