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

Random failure with mod_chat_lib_testcase::test_chat_get_sessions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.5, 3.6
    • Fix Version/s: 3.5.2
    • Component/s: Chat, Unit tests
    • Labels:
    • Testing Instructions:
      Hide

      Requires hacking codebase:

      1) Edit mod/chat/lib.php and, in the chat_login_user() function, exactly before the chat_send_chatmessage() call, add a 2 seconds sleep.

              } else {
      +           sleep(2);
                  chat_send_chatmessage($chatuser, 'enter', true);
              }
      

      2) Initialise PHPUnit:

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

      3) Run the chat unit tests (100 repetitions, yes 200 seconds, be patient):

      $ vendor/bin/phpunit --repeat 100 "mod_chat_lib_testcase" mod/chat/tests/lib_test.php
      

      4) Verify that execution ends without error.

      5) Optional: Before the fix and with the sleep() manually added in 1) it was consistently causing an assertion to fail with a 2 seconds difference. You can verify it if you want, without the fix applied.

      Show
      Requires hacking codebase: 1) Edit mod/chat/lib.php and, in the  chat_login_user()  function, exactly before the chat_send_chatmessage() call, add a 2 seconds sleep. } else { + sleep(2); chat_send_chatmessage($chatuser, 'enter', true); } 2) Initialise PHPUnit: php admin/tool/phpunit/cli/init.php 3) Run the chat unit tests (100 repetitions, yes 200 seconds, be patient): $ vendor/bin/phpunit --repeat 100 "mod_chat_lib_testcase" mod/chat/tests/lib_test.php 4) Verify that execution ends without error. 5) Optional: Before the fix and with the sleep() manually added in 1) it was consistently causing an assertion to fail with a 2 seconds difference. You can verify it if you want, without the fix applied.
    • Affected Branches:
      MOODLE_35_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_35_STABLE
    • Pull from Repository:
    • Pull 3.5 Branch:
    • Pull Master Branch:

      Description

      Have got this at least twice lately:

      mod_chat_lib_testcase::test_chat_get_sessions
      Failed asserting that two strings are equal.
      --- Expected
      +++ Actual
      @@ @@
      -'1533713120'
      +'1533713121'
       
      /var/www/html/mod/chat/tests/lib_test.php:206
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
      

      Usual timing random failure, at first sight. Looking to it.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                stronk7 Eloy Lafuente (stronk7)
                Reporter:
                stronk7 Eloy Lafuente (stronk7)
                Peer reviewer:
                Carlos Escobedo
                Integrator:
                Jake Dallimore
                Tester:
                Janelle Barcega
                Participants:
                Component watchers:
                Jake Dallimore, Jun Pataleta, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Sep/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h