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

Test retry of failed initial db connection #1269

Merged
merged 7 commits into from Jul 16, 2020
Merged

Conversation

c4ffein
Copy link
Contributor

@c4ffein c4ffein commented Jul 15, 2020

Tests for #1258 (review)

@codecov
Copy link

codecov bot commented Jul 15, 2020

Codecov Report

Merging #1269 into master will decrease coverage by 0.49%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1269      +/-   ##
==========================================
- Coverage   75.11%   74.62%   -0.50%     
==========================================
  Files         298      298              
  Lines       26324    27233     +909     
==========================================
+ Hits        19774    20322     +548     
- Misses       6550     6911     +361     
Impacted Files Coverage Δ
parsec/backend/postgresql/handler.py 82.06% <100.00%> (+4.98%) ⬆️
parsec/core/gui/devices_widget.py 77.84% <0.00%> (-12.71%) ⬇️
parsec/core/gui/users_widget.py 69.37% <0.00%> (-11.39%) ⬇️
parsec/core/logged_core.py 84.51% <0.00%> (-10.94%) ⬇️
parsec/core/gui/main_window.py 48.70% <0.00%> (-5.33%) ⬇️
parsec/backend/invite.py 90.20% <0.00%> (-0.79%) ⬇️
parsec/core/fs/workspacefs/entry_transactions.py 96.47% <0.00%> (-0.59%) ⬇️
parsec/core/gui/_resources_rc.py 79.54% <0.00%> (-0.46%) ⬇️
parsec/core/gui/workspaces_widget.py 70.25% <0.00%> (+0.25%) ⬆️
parsec/core/fs/workspacefs/workspacefs.py 96.28% <0.00%> (+0.61%) ⬆️
... and 7 more

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 d2d2470...2da3fcf. Read the comment docs.

tests/backend/test_postgres_db.py Outdated Show resolved Hide resolved
postgresql_url = re.sub(
":(\\d+)/", lambda m: f":{str(int(m.group()[1:-1])+1)}/", postgresql_url
)
with pytest.raises(OSError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with pytest.raises(OSError) as exc: to then test str(exc.value) == "<error message about the connection>" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you forgot to push the changes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, forgot one of the UT...

tests/backend/test_postgres_db.py Outdated Show resolved Hide resolved
tests/backend/test_postgres_db.py Outdated Show resolved Hide resolved
tests/backend/test_postgres_db.py Outdated Show resolved Hide resolved
):
postgresql_url = f"postgresql://localhost:{unused_tcp_port}/dummy"
with pytest.raises(OSError):
with trio.fail_after(3 * 3 + 1):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
:trollface:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😿

postgresql_url = re.sub(
":(\\d+)/", lambda m: f":{str(int(m.group()[1:-1])+1)}/", postgresql_url
)
with pytest.raises(OSError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you forgot to push the changes ?

Copy link
Member

@touilleMan touilleMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfection.

@c4ffein c4ffein merged commit 76cca00 into master Jul 16, 2020
@c4ffein c4ffein deleted the test-db-retry-connection branch July 16, 2020 12:38
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