-
Notifications
You must be signed in to change notification settings - Fork 573
Fix all date constructors to Date(0) to prevent test flakiness #4010
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
base: master
Are you sure you want to change the base?
Conversation
I don't think we want to add Date(0) to all of them, only the duplicates that should be removed. The issue happens because of this audiobookshelf/server/migrations/v2.15.0-series-column-unique.js Lines 124 to 139 in 565eb42
|
Am I correct that |
Yes, that is correct.
Sorry, I might have been hasty to put Date(0) on all of them, even though the test passes. But we definitely cannot leave the no-parameter Date constructor. It is not good practice to have a unit test where the input changes every time we run it. It is is called a test fixture for a reason. |
In this case we are testing that the series most recently updated is the one that was kept. |
I was able to reproduce the failure on the other issue but only after like 50 times running it. Best to write a loop if you want to reproduce |
I wrote a script that continuously runs the tests and was also able to reproduce the flakiness of this migration test. I believe I have fixed the flakiness of this migration, but found another flaky test in the
|
I was not able to figure out the flaky The |
Brief summary
Fix Date constructors to Date(0) to provide stable dates and prevent test flakiness
Which issue is fixed?
No issue.
In-depth Description
Using just Date() caused the test input to be unstable, and caused sporadic test failures.
How have you tested this?
Ran the test to make sure it still passes.