Fix Flaky tests
After each test execution, the database is reset to ensure that tests don't interact with each other. However, elasticsearch is not reset like this, causing inconsistencies between them.
Because elasticseach is then out of sync with the DB, the tests fail sometimes, i.e. if a test which deletes an item is executed before a test which modifies said item.
To fix it, we should identify the file which has this problem and use the refresh_elasticsearch
method on the correct model(s) in the setUp
method of the test class. We should look at some failed test stages of the CI to locate the flaky test(s).