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

Do panic in integration tests if connection can't be established #2577

Merged
merged 13 commits into from
May 8, 2023

Conversation

rumyantseva
Copy link
Contributor

@rumyantseva rumyantseva commented May 8, 2023

Description

In integration/setup/listener.go in the tb.Cleanup call we wait for a message from done channel. If the connection with the client wasn't established, this message will be never received, as listener is still runing. As a result, the tests are hanging until timeout. This PR fixes this problem by panicking if the connection can't be established.

For example, this problem occurred in this #2540 PR, and it was hard to catch the problem with failing integration tests.

Readiness checklist

  • I added/updated unit tests.
  • I added/updated integration/compatibility tests.
  • I added/updated comments and checked rendering.
  • I made spot refactorings.
  • I updated user documentation.
  • I ran task all, and it passed.
  • I ensured that PR title is good enough for the changelog.
  • (for maintainers only) I set Reviewers (@FerretDB/core), Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@rumyantseva rumyantseva added the code/chore Code maintenance improvements label May 8, 2023
@rumyantseva rumyantseva self-assigned this May 8, 2023
@codecov
Copy link

codecov bot commented May 8, 2023

Codecov Report

Merging #2577 (fb1fbf7) into main (5386d51) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2577      +/-   ##
==========================================
- Coverage   27.29%   27.28%   -0.01%     
==========================================
  Files         411      411              
  Lines       20148    20148              
==========================================
- Hits         5500     5498       -2     
- Misses      14077    14078       +1     
- Partials      571      572       +1     
Impacted Files Coverage Δ
integration/setup/client.go 34.92% <0.00%> (-3.18%) ⬇️
Flag Coverage Δ
integration 5.50% <0.00%> (-0.02%) ⬇️
mongodb 5.50% <0.00%> (-0.02%) ⬇️
unit 25.63% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@rumyantseva rumyantseva changed the title Fix problem with tests running forever if connection can't be established Stop listener in integration tests if connection can't be established May 8, 2023
@rumyantseva rumyantseva marked this pull request as ready for review May 8, 2023 15:22
@rumyantseva rumyantseva requested a review from a team as a code owner May 8, 2023 15:22
@rumyantseva rumyantseva requested review from AlekSi and w84thesun May 8, 2023 15:22
@rumyantseva rumyantseva enabled auto-merge (squash) May 8, 2023 15:22
@rumyantseva rumyantseva requested review from a team, chilagrow and noisersup May 8, 2023 15:22
integration/setup/client.go Outdated Show resolved Hide resolved
@rumyantseva rumyantseva changed the title Stop listener in integration tests if connection can't be established Do panic in integration tests if connection can't be established May 8, 2023
@rumyantseva rumyantseva requested a review from AlekSi May 8, 2023 16:03
Copy link
Contributor

@w84thesun w84thesun left a comment

Choose a reason for hiding this comment

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

Nice catch!

@AlekSi AlekSi added this to the v1.1.0 milestone May 8, 2023
Copy link
Member

@noisersup noisersup left a comment

Choose a reason for hiding this comment

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

Nice one!

@rumyantseva rumyantseva merged commit 050702e into FerretDB:main May 8, 2023
@rumyantseva rumyantseva deleted the fix-waiting-in-tests branch May 8, 2023 18:24
@AlekSi AlekSi modified the milestones: v1.1.0, v1.2.0 May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants