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

Unit test failures and php notice/error if database query logging is enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 3.1.3, 3.2, 3.3.3, 3.4
    • Database SQL/XMLDB
    • MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE

      While testing MDL-57192, multiple problems were detected if $CFG->dboptions["logall"] = true;

      With Mariadb:

      Running vendor/bin/behat continuously says that the environment is not ok, even if you drop and re-create using php admin/tool/phpunit/cli/init.php

      With MSSQL

      Following unit test failures was observed.

      $ vendor/bin/phpunit core_message_externallib_testcase message/tests/externallib_test.php
      Moodle 3.3dev (Build: 20161222), b6f5e57e450452fbecb59d4b50c054f3b1d50186
      Php: 5.6.28, mssql: 11.00.2100, OS: Darwin 16.3.0 x86_64
      PHPUnit 5.5.7 by Sebastian Bergmann and contributors.
       
      ...............E................................................  64 / 64 (100%)
       
      Time: 34.63 seconds, Memory: 478.75MB
       
      There was 1 error:
       
      1) core_message_externallib_testcase::test_get_user_notification_preferences
      uasort(): Array was modified by the user comparison function
       
      /Users/stronk7/git_moodle/integration/message/classes/output/preferences/notification_list.php:138
      /Users/stronk7/git_moodle/integration/message/externallib.php:2453
      /Users/stronk7/git_moodle/integration/message/tests/externallib_test.php:931
      /Users/stronk7/git_moodle/integration/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
       vendor/bin/phpunit core_message_externallib_testcase message/tests/externallib_test.php
       
      ERRORS!
      Tests: 64, Assertions: 430, Errors: 1.
      stronk7@~/git_moodle/integration (master=)$ vendor/bin/phpunit core_cache_testcase cache/tests/cache_test.php
      Moodle 3.3dev (Build: 20161222), b6f5e57e450452fbecb59d4b50c054f3b1d50186
      Php: 5.6.28, mssql: 11.00.2100, OS: Darwin 16.3.0 x86_64
      PHPUnit 5.5.7 by Sebastian Bergmann and contributors.
       
      ..........................F............                           39 / 39 (100%)
       
      Time: 7.76 seconds, Memory: 492.75MB
       
      There was 1 failure:
       
      1) core_cache_testcase::test_disable
      Failed asserting that file "/Users/stronk7/Sites/moodle_data_gitintegration/master/mssql_phpunit/muc/config.php" does not exist.
       
      /Users/stronk7/git_moodle/integration/cache/tests/cache_test.php:1321
      /Users/stronk7/git_moodle/integration/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
       vendor/bin/phpunit core_cache_testcase cache/tests/cache_test.php
       
      FAILURES!
      Tests: 39, Assertions: 1320, Failures: 1.
      

      With Sqlsrv
      1. Installation fails with the following error.
      2. Unit test fails with the same error.
      3. While manually creating a category it fails with same error.

        c:\Apache24\htdocs\integration>php admin\tool\phpunit\cli\init.php
        Initialising Moodle PHPUnit test environment...
        You are already using composer version 1.3.0 (stable channel).
        Loading composer repositories with package information
        Installing dependencies (including require-dev) from lock file
        Nothing to install or update
        Generating autoload files
        -->System
        Default exception handler: Can not find data record in database table course_categories. Debug: SELECT id,parent FROM {course_categories} WHERE id = ?
        [array (
          0 => 523,
        )]
        Error code: invalidrecord
        * line 1526 of \lib\dml\moodle_database.php: dml_missing_record_exception thrown
        * line 1502 of \lib\dml\moodle_database.php: call to moodle_database->get_record_select()
        * line 6362 of \lib\accesslib.php: call to moodle_database->get_record()
        * line 115 of \lib\db\install.php: call to context_coursecat::instance()
        * line 1626 of \lib\upgradelib.php: call to xmldb_main_install()
        * line 481 of \lib\installlib.php: call to install_core()
        * line 450 of \lib\phpunit\classes\util.php: call to install_cli_database()
        * line 150 of \admin\tool\phpunit\cli\util.php: call to phpunit_util::install_site()
         
        !!! Can not find data record in database table course_categories. !!!
        !! SELECT id,parent FROM {course_categories} WHERE id = ?
        [array (
          0 => 523,
        )]
        Error code: invalidrecord !!
        !! Stack trace: * line 1526 of \lib\dml\moodle_database.php: dml_missing_record_exception thrown
        * line 1502 of \lib\dml\moodle_database.php: call to moodle_database->get_record_select()
        * line 6362 of \lib\accesslib.php: call to moodle_database->get_record()
        * line 115 of \lib\db\install.php: call to context_coursecat::instance()
        * line 1626 of \lib\upgradelib.php: call to xmldb_main_install()
        * line 481 of \lib\installlib.php: call to install_core()
        * line 450 of \lib\phpunit\classes\util.php: call to install_cli_database()
        * line 150 of \admin\tool\phpunit\cli\util.php: call to phpunit_util::install_site()
         !!
        Permalink
        

      With oracle
      1. Installation fails with following error
      2. Unit test fails with same error.
      3. NO issues found while exploratory testing, but could be similar issue if test longer.

        Default exception handler: Error reading from database Debug: ORA-01000: maximum open cursors exceeded
        ORA-04088: error during execution of trigger 'SYSTEM.TCAPA_ID_TRG'
         
        [NULL]
        Error code: dmlreadexception
        * line 479 of /lib/dml/moodle_database.php: dml_read_exception thrown
        * line 277 of /lib/dml/oci_native_moodle_database.php: call to moodle_database->query_end()
        * line 1289 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
        * line 1336 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->insert_record_raw()
        * line 2437 of /lib/accesslib.php: call to oci_native_moodle_database->insert_record()
        * line 266 of /lib/db/install.php: call to update_capabilities()
        * line 1626 of /lib/upgradelib.php: call to xmldb_main_install()
        * line 481 of /lib/installlib.php: call to install_core()
        * line 450 of /lib/phpunit/classes/util.php: call to install_cli_database()
        * line 150 of /admin/tool/phpunit/cli/util.php: call to phpunit_util::install_site()
         
        !!! Error reading from database !!!
        !! ORA-01000: maximum open cursors exceeded
        ORA-04088: error during execution of trigger 'SYSTEM.TCAPA_ID_TRG'
         
        [NULL]
        Error code: dmlreadexception !!
        !! Stack trace: * line 479 of /lib/dml/moodle_database.php: dml_read_exception thrown
        * line 277 of /lib/dml/oci_native_moodle_database.php: call to moodle_database->query_end()
        * line 1289 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
        * line 1336 of /lib/dml/oci_native_moodle_database.php: call to oci_native_moodle_database->insert_record_raw()
        * line 2437 of /lib/accesslib.php: call to oci_native_moodle_database->insert_record()
        * line 266 of /lib/db/install.php: call to update_capabilities()
        * line 1626 of /lib/upgradelib.php: call to xmldb_main_install()
        * line 481 of /lib/installlib.php: call to install_core()
        * line 450 of /lib/phpunit/classes/util.php: call to install_cli_database()
        * line 150 of /admin/tool/phpunit/cli/util.php: call to phpunit_util::install_site()
         !!
        Exception ignored in shutdown function 'upgrade_finished_handler':Error reading from database (ORA-01000: maximum open cursors exceeded
        SELECT CNAME, COLTYPE, nvl(CHAR_LENGTH, WIDTH) AS WIDTH, SCALE, PRECISION, NULLS, DEFAULTVAL,
                          DECODE(NVL(TRIGGER_NAME, '0'), '0', '0', '1') HASTRIGGER
                          FROM COL c
                     LEFT JOIN USER_TAB_COLUMNS u ON (u.TABLE_NAME = c.TNAME AND u.COLUMN_NAME = c.CNAME AND u.DATA_TYPE = 'VARCHAR2')
                     LEFT JOIN USER_TRIGGERS t ON (t.TABLE_NAME = c.TNAME AND TRIGGER_TYPE = 'BEFORE EACH ROW' AND c.CNAME = 'ID')
                         WHERE TNAME = UPPER('tconfig')
                      ORDER BY COLNO
        [NULL])
        

            Unassigned Unassigned
            rajeshtaneja Rajesh Taneja
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.