-
Bug
-
Resolution: Fixed
-
Minor
-
3.4
-
MOODLE_34_STABLE
-
MOODLE_34_STABLE
-
MDL-60705-master -
aolley points out that code in the mock search engine for faking time (introduced in MDL-60555) is incorrect by a factor of a million; the code used to call usleep which is measured in microseconds, and has now been changed to add to a numeric variable that is stored in seconds.
This did not cause the unit tests to fail, which indicated somewhat of an inadequacy in the unit tests. Code in the tests was basically along the lines of:
- Set a time limit so that only 2 items will be processed
- Check that only 2 items were processed
However, because of the way that search time limits work, there is usually a minimum of 2 items that need to be processed before it really even checks the time limit. (This is because it guarantees to make some progress each time, which means it has to get onto the next second; it does this by, roughly, requiring to process items with different time values, which means it must process at least 2.)
I have changed one of the unit tests so that 3 items will be processed. This now fails as expected with the old code (that was out by a factor of a million) and passes again once that code is corrected.