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

Problem on 1st phpunit runs using mariadb (possibly others too)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 2.9.5, 3.0.3
    • Component/s: Unit tests
    • Labels:
    • Testing Instructions:
      Hide
      create & start mariadbd 10.0.0 cocker instance
      1. Copy attached Dockerfile to a dome folder and run below command within the directory.

        docker build -t mymariadb:10.1 .

      2. Start docker image

        docker run -p 3309:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=moodle -e MYSQL_DATABASE=moodle -e MYSQL_USER=moodle -e MYSQL_PASSWORD=moodle -d mymariadb:10.1 --innodb_file_per_table=1 --innodb_file_format=Barracuda
        

      Run phpunit
      1. Update config.php with
        • dbhost = localhost
        • dbuser = moodle
        • dbpass = moodle
        • dbport = 3309
        • dbtype = mariadb
      2. Initialise phpunit

         php admin/tool/phpunit/cli/init.php

      3. Run phpunit

         vendor/bin/phpunit

      Show
      create & start mariadbd 10.0.0 cocker instance Copy attached Dockerfile to a dome folder and run below command within the directory. docker build -t mymariadb:10.1 . Start docker image docker run -p 3309:3306 --name mariadb -e MYSQL_ROOT_PASSWORD=moodle -e MYSQL_DATABASE=moodle -e MYSQL_USER=moodle -e MYSQL_PASSWORD=moodle -d mymariadb:10.1 --innodb_file_per_table=1 --innodb_file_format=Barracuda Run phpunit Update config.php with dbhost = localhost dbuser = moodle dbpass = moodle dbport = 3309 dbtype = mariadb Initialise phpunit php admin/tool/phpunit/cli/init.php Run phpunit vendor/bin/phpunit
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull Master Branch:
      wip-mdl-52799

      Description

      Maybe a regression of MDL-52060, maybe not...

      ... today I've been installing a number of (docker, I assume the same happens with normal instances) mariadb phpunit databases... and consistently, the first run always failed this test:

      1) core_phpunit_advanced_testcase::test_database_reset
      Failed asserting that 141000 matches expected 1.
       
      /Users/stronk7/git_moodle/testing/lib/phpunit/tests/advanced_test.php:178
      /Users/stronk7/git_moodle/testing/lib/phpunit/classes/advanced_testcase.php:80
       
      To re-run:
       vendor/bin/phpunit core_phpunit_advanced_testcase lib/phpunit/tests/advanced_test.php
      

      Only happens the first run. Running it again passes ok.

      Steps to reproduce:

      $ docker run -p 3307:3306 --name mariadb101 -e MYSQL_ROOT_PASSWORD=xxxxxx -e MYSQL_DATABASE=moodle -e MYSQL_USER=xxxxxx -e MYSQL_PASSWORD=xxxxxx -d mariadb:10.1 --innodb_file_per_table=1 --innodb_file_format=Barracuda
      ...
      ...
      431ade13646f8c56c003232c41633f1279ca020103be2e6dbab4db71a24c7c06
       
      $ php admin/tool/phpunit/cli/init.php
      ...
      ...
      PHPUnit test environment setup complete.
       
      $ vendor/bin/phpunit (fails)
      ....F
       
      $ vendor/bin/phpunit (passes)
      .............................................................
       
      $ docker stop mariadb101
      mariadb101
       
      $ docker rm mariadb101
      mariadb101
      

      Have been trying to find a similar issue, but have failed to do so. Not sure if that's known issue. Haven't tried with other databases either.

      Ciao

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Mar/16