-
Bug
-
Resolution: Fixed
-
Minor
-
3.6.3
-
MOODLE_36_STABLE
-
MOODLE_35_STABLE, MOODLE_36_STABLE
-
wip-
MDL-65220-master -
When running tests I am creating for the new mobile App behat framework I am sometimes experiencing database data left over when starting a new scenario in the feature file.
This tends to occur when the App steps are the last listed in the scenario.
I haven't been able to replicate on any of the core tests such as forum - and the problem is intermittent and hard to replicate at will.
From debugging I can see that the App is making lots of webservice requests simultaneously - this results in lots of simultaneous database updates/inserts that are running in independant PHP threads.
\testing_util::set_table_modified_by_sql() captures all DB updates/inserts whilst the tests are running and writes the relevant table to behatrun/tablesupdatedbyscenario.json.
I am finding issues when there are large volumes of concurrent table changes as the json file read fails (presumably as it is currently being written by another thread) and so the list of changed tables is updated with the latest change only. The result of this is that the changed tables are then not reset on starting the next scenario.
The issue is related to multiple updates to the webservice_tokens table - looking at the code it is unnecessary to continually update the json file with an existing value so I propose testing for this before making the write.