Moodle
  1. Moodle
  2. MDL-34130

Add more recordset related unit tests

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2, 2.3, 2.4
    • Fix Version/s: 2.3.1
    • Component/s: Database SQL/XMLDB
    • Labels:
      None

      Description

      1/ verify nested recordset works
      2/ verify transactions work when in recordset
      3/ verify the recordsets are static (do not change after later update/delete queries)

      Problems are expected mostly in sqlsrv driver, see MDL-34069 and friends. This issue is not supposed to fix these existing problems...

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Eloy Lafuente (stronk7) added a comment -

            Integrated, thanks! (23 and master)

            Show
            Eloy Lafuente (stronk7) added a comment - Integrated, thanks! (23 and master)
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Tested the complete dml tests are passing without problems under:

            • MySQL
            • PostgreSQL
            • MSSQL (freeTDS): 2 exceptions, about mssql_data_seek(), not dangerous and 100% unrelated with the nested recordsets and transactions problems.
            • Oracle: 1 failure, about non ANSI concat of nulls

            So I'm passing this. It would be great if somebody could paste here the problems happening with the sqlsrv driver, TIA!

            Show
            Eloy Lafuente (stronk7) added a comment - Tested the complete dml tests are passing without problems under: MySQL PostgreSQL MSSQL (freeTDS): 2 exceptions, about mssql_data_seek(), not dangerous and 100% unrelated with the nested recordsets and transactions problems. Oracle: 1 failure, about non ANSI concat of nulls So I'm passing this. It would be great if somebody could paste here the problems happening with the sqlsrv driver, TIA!
            Hide
            Petr Skoda added a comment - - edited

            sqlsrv on Windows 8 using 3.0 driver - MARS enabled in our sqlsrv driver

            c:\server\workspace\moodle>phpunit dml_testcase lib/dml/tests/dml_test.php
            PHPUnit 3.6.11 by Sebastian Bergmann.
             
            Configuration read from C:\server\workspace\moodle\phpunit.xml
             
            ................................................................. 65 / 87 ( 74%)
            ..............EEF.....
             
            Time: 10 seconds, Memory: 38.50Mb
             
            There were 2 errors:
             
            1) dml_testcase::test_nested_transactions
            dml_read_exception: Error reading from database (SQLState: 42000<br>
            Error Code: 3988<br>
            Message: [Microsoft][SQL Server Native Client 11.0][SQL Server]New transaction is not allowed because there are other threads running in the session.<br>
             
            native sqlsrv_begin_transaction
            [NULL])
             
            C:\server\workspace\moodle\lib\dml\moodle_database.php:407
            C:\server\workspace\moodle\lib\dml\sqlsrv_native_moodle_database.php:258
            C:\server\workspace\moodle\lib\dml\sqlsrv_native_moodle_database.php:1368
            C:\server\workspace\moodle\lib\dml\moodle_database.php:2101
            C:\server\workspace\moodle\lib\dml\tests\dml_test.php:4226
            C:\Program Files (x86)\PHP\v5.3\phpunit:46
             
            To re-run:
             phpunit dml_testcase C:\server\workspace\moodle\lib\dml\tests\dml_test.php
             
            2) dml_testcase::test_transactions_forbidden
            dml_transaction_exception: Database transaction error (This code can not be excecuted in transaction)
             
            C:\server\workspace\moodle\lib\dml\moodle_database.php:2076
            C:\server\workspace\moodle\lib\dml\tests\dml_test.php:4251
            C:\Program Files (x86)\PHP\v5.3\phpunit:46
             
            To re-run:
             phpunit dml_testcase C:\server\workspace\moodle\lib\dml\tests\dml_test.php
             
            --
             
             
            There was 1 failure:
             
            1) dml_testcase::test_wrong_transactions
            Failed asserting that 2 matches expected 0.
             
            C:\server\workspace\moodle\lib\dml\tests\dml_test.php:4302
            C:\Program Files (x86)\PHP\v5.3\phpunit:46
             
            To re-run:
             phpunit dml_testcase C:\server\workspace\moodle\lib\dml\tests\dml_test.php
             
            FAILURES!
            Tests: 87, Assertions: 970, Failures: 1, Errors: 2.
             
            c:\server\workspace\moodle>
            

            Show
            Petr Skoda added a comment - - edited sqlsrv on Windows 8 using 3.0 driver - MARS enabled in our sqlsrv driver c:\server\workspace\moodle>phpunit dml_testcase lib/dml/tests/dml_test.php PHPUnit 3.6.11 by Sebastian Bergmann.   Configuration read from C:\server\workspace\moodle\phpunit.xml   ................................................................. 65 / 87 ( 74%) ..............EEF.....   Time: 10 seconds, Memory: 38.50Mb   There were 2 errors:   1) dml_testcase::test_nested_transactions dml_read_exception: Error reading from database (SQLState: 42000<br> Error Code: 3988<br> Message: [Microsoft][SQL Server Native Client 11.0][SQL Server]New transaction is not allowed because there are other threads running in the session.<br>   native sqlsrv_begin_transaction [NULL])   C:\server\workspace\moodle\lib\dml\moodle_database.php:407 C:\server\workspace\moodle\lib\dml\sqlsrv_native_moodle_database.php:258 C:\server\workspace\moodle\lib\dml\sqlsrv_native_moodle_database.php:1368 C:\server\workspace\moodle\lib\dml\moodle_database.php:2101 C:\server\workspace\moodle\lib\dml\tests\dml_test.php:4226 C:\Program Files (x86)\PHP\v5.3\phpunit:46   To re-run: phpunit dml_testcase C:\server\workspace\moodle\lib\dml\tests\dml_test.php   2) dml_testcase::test_transactions_forbidden dml_transaction_exception: Database transaction error (This code can not be excecuted in transaction)   C:\server\workspace\moodle\lib\dml\moodle_database.php:2076 C:\server\workspace\moodle\lib\dml\tests\dml_test.php:4251 C:\Program Files (x86)\PHP\v5.3\phpunit:46   To re-run: phpunit dml_testcase C:\server\workspace\moodle\lib\dml\tests\dml_test.php   --     There was 1 failure:   1) dml_testcase::test_wrong_transactions Failed asserting that 2 matches expected 0.   C:\server\workspace\moodle\lib\dml\tests\dml_test.php:4302 C:\Program Files (x86)\PHP\v5.3\phpunit:46   To re-run: phpunit dml_testcase C:\server\workspace\moodle\lib\dml\tests\dml_test.php   FAILURES! Tests: 87, Assertions: 970, Failures: 1, Errors: 2.   c:\server\workspace\moodle>
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Closing this as fixed, changes are now available upstream.

            Big thanks!

            Show
            Eloy Lafuente (stronk7) added a comment - Closing this as fixed, changes are now available upstream. Big thanks!

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: