Fix erratic tests
We have several tests marked as "erratic". AFAICT this was introduced in !3572 (merged) because we saw tests fail from time to time without the code actually being wrong.
Although a good "quick fix", it does feel a bit wrong to allow tests to fail, because what's the point of tests then.
Two cases I came across were lists fetched from the database that assumed to be in a specific order, while the select wasn't ordered. See !3636 (merged) and !3653 (merged).
Another example is a timing issue, !3614 (diffs). This seems similar to the following failure I see
1) test updating a filter with adding expires_at (Pleroma.Web.MastodonAPI.FilterControllerTest)
test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs:181
Assertion with == failed
code: assert response["expires_at"] == NaiveDateTime.utc_now() |> NaiveDateTime.add(in_seconds) |> Pleroma.Web.CommonAPI.Utils.to_masto_date()
left: "2022-04-05T12:14:22.000Z"
right: "2022-04-05T12:14:23.000Z"
stacktrace:
test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs:198: (test)
Merge requests related to erratic: https://git.pleroma.social/pleroma/pleroma/-/merge_requests?scope=all&state=merged&search=erratic
I also see an issue to discover "new" erratic tests #2808
You can run the erratic tests with mix test --only erratic
Have fun and happy bug squashing