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

Random test failure in backup cron helper

    XMLWordPrintable

Details

    • MOODLE_311_STABLE
    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • Hide

      1. Init phpunit and then copy the following into a file called runner.sh in your site root:

      #!/bin/bash
      for i in {1..50}
      do
          vendor/bin/phpunit backup/util/helper/tests/cronhelper_test.php
      done 
      

      2. Save the file
      3. Run:

      sudo chmod +x runner.sh

      4. Run the script:

      ./runner.sh

      5. Verify that for all 50 iterations you see 100%/success notices (no errors).

      Show
      1. Init phpunit and then copy the following into a file called runner.sh in your site root: #!/bin/bash for i in { 1 .. 50 } do     vendor/bin/phpunit backup/util/helper/tests/cronhelper_test.php done 2. Save the file 3. Run: sudo chmod +x runner.sh 4. Run the script: ./runner.sh 5. Verify that for all 50 iterations you see 100%/success notices (no errors).

    Description

      This query: https://github.com/moodle/moodle/blob/6652ec135b08e6633e7f82570edc65f7abb6c1f0/backup/util/helper/backup_cron_helper.class.php#L90-L96 can produce random ordering when the two ordered fields are equal, as happens in the accompanying testcase: https://github.com/moodle/moodle/blob/6652ec135b08e6633e7f82570edc65f7abb6c1f0/backup/util/helper/tests/cronhelper_test.php#L379-L393 (originally from MDL-65201)

      This results in failures such as the following:

      1) backup_cron_helper_testcase::test_get_courses
      Failed asserting that two strings are equal.
      --- Expected
      +++ Actual
      @@ @@
      -'148002'
      +'148003'
       
      /home/runner/work/moodle/moodle/backup/util/helper/tests/cronhelper_test.php:427
      /home/runner/work/moodle/moodle/lib/phpunit/classes/advanced_testcase.php:80
      

      e.g. here: https://github.com/mudrd8mz/moodle/runs/5056386624?check_suite_focus=true

      Attachments

        Issue Links

          Activity

            People

              pholden Paul Holden
              pholden Paul Holden
              Sujith Haridasan Sujith Haridasan
              Jake Dallimore Jake Dallimore
              Gladys Basiana Gladys Basiana
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                11/Jul/22

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 15 minutes
                  2h 15m