Skip to content

test: Investigate flaky tests by turning off tests randomizer #9181

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 1 commit into from
Jul 7, 2024

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Jul 7, 2024

Pull Request

Issue

Attempt to fix flaky tests when the server isn't properly initialized. I believe this is caused by tests that shuts down the server to reproduce a disconnection and restarts. I am unable to reproduce this issue local so the CI should be ran a few times to ensure it works.

Closes: #9149

Approach

  • Enable live query server by default
  • Track connections to live query server
  • Properly destroy connections
  • Properly handle open connections
  • Enable encodeParseObjectInCloudFunction by default
  • Turn off randomizer in test suite

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)
  • Add security check
  • Add new Parse Error codes to Parse JS SDK

Copy link

Thanks for opening this pull request!

Copy link

codecov bot commented Jul 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.16%. Comparing base (2ecc5a5) to head (ad4ab19).

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha    #9181      +/-   ##
==========================================
+ Coverage   93.78%   94.16%   +0.37%     
==========================================
  Files         186      186              
  Lines       14729    14729              
==========================================
+ Hits        13814    13869      +55     
+ Misses        915      860      -55     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dplewis
Copy link
Member Author

dplewis commented Jul 7, 2024

@mtrezza All the test passed!

@dplewis dplewis requested review from mtrezza and a team July 7, 2024 23:04
@mtrezza mtrezza changed the title test: Fix flaky tests by turning off randomizer test: Investigate flaky tests by turning off tests randomizer Jul 7, 2024
@mtrezza mtrezza merged commit e7199e8 into parse-community:alpha Jul 7, 2024
26 checks passed
@dplewis
Copy link
Member Author

dplewis commented Jul 7, 2024

Just FYI,

server.close(callback) Stops the server from accepting new connections and keeps existing connections. This function is asynchronous, the server is finally closed when all connections are ended. I made sure to close all connections before shutting down the server.

Per documentation https://nodejs.org/api/net.html#serverclosecallback

The promise never resolved which lead to timeouts and if it did resolve in the middle of a test we get invalid server state initialized because it's mounted but not started

await new Promise(resolve => parseServer.server.close(resolve));

@dplewis dplewis deleted the cannot-close branch July 7, 2024 23:28
@mtrezza
Copy link
Member

mtrezza commented Jul 8, 2024

Good investigation!

@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 7.1.0-alpha.15

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Jul 8, 2024
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 7.2.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label Jul 9, 2024
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 7.2.0

@parseplatformorg parseplatformorg added the state:released Released as stable version label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky Tests Invalid server state: initialized
3 participants