parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.69k stars 4.76k forks source link

Flaky Tests Invalid server state: initialized #9149

Open dplewis opened 3 weeks ago

dplewis commented 3 weeks ago

New Issue Checklist

Issue Description

The test suite in this repo and in the JS SDK both have flaky tests. I believe this is due to the asyncronous nature of starting the server instance.

await ParseServer.startApp(newConfiguration);

I think the issue is after the promise resolves the server is still initializing. https://github.com/parse-community/parse-server/pull/8232

Parse.Query testing dontSelect query without conditions
  - Unhandled promise rejection: ParseError: 111 Invalid server state: initialized,ParseError: 111 Invalid server state: initialized,ParseError: 111 Invalid server state: initialized,ParseError: 111 Invalid server state: initialized,ParseError: 111 Invalid server state: initialized  

Steps to reproduce

I can't reproduce this locally

Actual Outcome

Tests fail

Expected Outcome

Test Pass

parse-github-assistant[bot] commented 3 weeks ago

Thanks for opening this issue!

mtrezza commented 3 weeks ago

So initialized is the state after calling the ParseServer constructor. As soon as you call start() on the instance, the state changes to starting. From what you describe it looks like start() has not been called at all, because starting is set synchronously after calling start(). So it may be related to the reconfigureServer logic; that promise may return early, rather than the server init itself. Which would be good, because that means it's only a testing issue, not a server issue.

mtrezza commented 5 days ago

Closing via https://github.com/parse-community/Parse-SDK-JS/pull/2183

mtrezza commented 5 days ago

Re-opened, I think we first need to upgrade the Parse JS SDK in Parse Server to see whether the Parse Server CI shows less flakiness.

dplewis commented 4 days ago

I agree, I still don’t know why this is happening. I would like to think I solved it on the JS SDK

IMG_0502

mtrezza commented 3 days ago

Issue still occurs in recent PRs; I have never seen this before; is this a recently introduced issue?