instedd / surveda

InSTEDD Surveda
https://instedd.org/technologies/surveda-mobile-surveys/
GNU General Public License v3.0
17 stars 6 forks source link

Fix 'Stop MO' tests #2340

Closed anaPerezGhiglia closed 4 months ago

anaPerezGhiglia commented 4 months ago

Context

Stop MO tests have been failing erratically. They have been failing even before changing the ChannelBroker to use the Respondent.with_lock mutex. This is an evidence of that

Discovery

The tests were not filtering by respondent_id, so they could be using another records than the intended ones for the assertions. The tests were using plain Repo.one! for fetching Respondent, SurveyLogEntry and RespondentDispositionHistory models. The thing is that Mix runs tests of different modules in parallel and other tests insert records in those tables, so there is no guarantee from the stop mo tests that they will be testing the same respondent activity throughout the test

Observations

I could not replicate the failures locally, so I actually have no guarantee that these changes fix them. However I find this a plausible cause of the failures Leaving here some other examples of the failures in GHA