Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-61690

Browser cache too greedy during behat




      As discovered in MDL-58605, when we run Behat we are too greedy with our browser cache.

      Technically speaking it is working with the correct greediness, but certain facets of our testing framework mean that it appears too greedy. Specifically, we perform a DB reset befre each test which resets various IDs.


      • In your behat test tou upload a SCORM package which contains a file '/shared/example.js' which is empty
      • You are assigned a contextid of 7, and a SCORM revision of 1
      • The Behat test causes the file to be fetched in the browser and it is cached
      • A short while later the test ends
      • Later still a new test starts.
      • A different SCORM package is uploaded. It also contains a file '/shared/example.js' which has some content
      • Because of the reset you are again assigned contextid 7 and revision 1
      • Later the test runs and the file is requested
      • The browser spots that the URL being requested (/pluginfile.php/[contextid]/mod_scorm/content/[revision]/shared/example.js}) is in the cache, and returns it
      • The content of the file is empty rather than the new content

      The proposal I have raised with Eloy is to modify send_file to disable immutability, and set the lifetime to 0, which should disable the browser cache.


        Issue Links



              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Dan Marsden, Matteo Scaramuccia, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              1 Vote for this issue
              4 Start watching this issue