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

PHPUnit test failing based on 'fetchbuffersize' dboption

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.7
    • Fix Version/s: None
    • Labels:
      None
    • Affected Branches:
      MOODLE_37_STABLE

      Description

      It seems that some tests in Moodle, asserting performance reads... don't pass if the site has been configure to use some "small" 'fetchbuffersize' dboption.

      • With 'fetchbuffersize' => 1 I get:

        $ vendor/bin/phpunit lib/tests/accesslib_test.php 
        Moodle 3.7dev (Build: 20190301), 54c2b176040c4cd65d921bf10123b5146eb486f5
        Php: 7.1.26, pgsql: 9.6.11, OS: Darwin 18.2.0 x86_64
        PHPUnit 6.5.13 by Sebastian Bergmann and contributors.
         
        ...............................................F................. 65 / 75 ( 86%)
        ..........                                                        75 / 75 (100%)
         
        Time: 16.96 seconds, Memory: 66.00MB
         
        There was 1 failure:
         
        1) core_accesslib_testcase::test_role_definition_caching
        Failed asserting that 182 matches expected 3.
         
        /Users/stronk7/git_moodle/integration/lib/tests/accesslib_test.php:1933
        /Users/stronk7/git_moodle/integration/lib/phpunit/classes/advanced_testcase.php:80
         
        To re-run:
         vendor/bin/phpunit "core_accesslib_testcase" lib/tests/accesslib_test.php
         
        FAILURES!
        Tests: 75, Assertions: 16538, Failures: 1.
        

      • With 'fetchbuffersize' not set, aka, defaulting to huge number, it passes:

        $ vendor/bin/phpunit lib/tests/accesslib_test.php 
        Moodle 3.7dev (Build: 20190301), 54c2b176040c4cd65d921bf10123b5146eb486f5
        Php: 7.1.26, pgsql: 9.6.11, OS: Darwin 18.2.0 x86_64
        PHPUnit 6.5.13 by Sebastian Bergmann and contributors.
         
        ................................................................. 65 / 75 ( 86%)
        ..........                                                        75 / 75 (100%)
         
        Time: 16.36 seconds, Memory: 66.00MB
         
        OK (75 tests, 16543 assertions)
        

      Ideally, tests should pass irrespectively of that setting, so the 'fetchbuffersize' can be continuously tested with different values. That may imply that we have to change the code in the test in charge of calculate how many operations a query is.

      Only reproduced in master (3.7dev) but other branches may be affected too.

      Ciao

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta, Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: