Skip to content

Add unittest for PubSub.connect() #2167

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

Merged
merged 2 commits into from
May 8, 2022

Conversation

kristjanvalur
Copy link
Contributor

Pull Request check-list

Please make sure to review and check all of these items:

  • Does $ tox pass with this change (including linting)?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

Issue #2089 demonstrates how it was difficult to keep a PubSub loop running in face of ConnectionError since the
message getting methods don't automatically reconnect.

After PR #2148 it is now possible to call PubSub.connect() to refresh connectivity as part of a handling loop.

This PR adds a unittest which tests that such a loop successfully reconnects after being disconnected.

@codecov-commenter
Copy link

codecov-commenter commented May 4, 2022

Codecov Report

Merging #2167 (994da43) into master (5c99e27) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #2167      +/-   ##
==========================================
+ Coverage   91.98%   92.01%   +0.02%     
==========================================
  Files         105      105              
  Lines       25287    25334      +47     
==========================================
+ Hits        23260    23310      +50     
+ Misses       2027     2024       -3     
Impacted Files Coverage Δ
tests/test_asyncio/test_pubsub.py 99.40% <100.00%> (+0.06%) ⬆️
tests/test_asyncio/test_search.py 98.35% <0.00%> (-0.33%) ⬇️
tests/test_cluster.py 97.48% <0.00%> (ø)
redis/asyncio/connection.py 84.83% <0.00%> (+0.11%) ⬆️
redis/asyncio/client.py 92.85% <0.00%> (+0.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c99e27...994da43. Read the comment docs.

@dvora-h
Copy link
Collaborator

dvora-h commented May 8, 2022

Thanks @kristjanvalur! Great to see improvements for our tests

@dvora-h dvora-h added the maintenance Maintenance (CI, Releases, etc) label May 8, 2022
@dvora-h dvora-h merged commit 963843b into redis:master May 8, 2022
@kristjanvalur kristjanvalur deleted the pr_reconnect_listen branch May 9, 2022 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance (CI, Releases, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants