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

Prevent false-positive failures due to time differences

XMLWordPrintable

    • 5
    • BACKEND Sprint 6

      Some tests fail if they happen to run when the second changes over. This is annoying as it causes random failures.

      (It might be difficult to fix in general, but one option is to make tests allow a 1 second leeway, i.e. rather than doing, assert that $time1 == $time2, do assert that $time2 - $time1 < 2.)

      There might already be an issue for this but in case not, I'm filing one to start the ball rolling. (I did a search for the test_group_updated_event string and didn't find anything.)

      core_group_lib_testcase::test_group_updated_event
      Event legacy data does not match expected value.
      Failed asserting that two objects are equal.
      --- Expected
      +++ Actual
      @@ @@
           'timecreated' => '1379077452'
      -    'timemodified' => '1379077452'
      +    'timemodified' => '1379077453'
       )
      

      And links from Dan (inc this and others):

      http://integration.moodle.org/job/20.%20Run%20phpunit%20UnitTests%20(master)/1668/testReport/(root)/core_setuplib_testcase/test_localcachedir/

      http://integration.moodle.org/job/20.%20Run%20phpunit%20UnitTests%20(master)/1665/testReport/junit/(root)/core_group_lib_testcase/test_group_updated_event/

      http://integration.moodle.org/job/20.%20Run%20phpunit%20UnitTests%20(master)/1623/testReport/junit/(root)/core_setuplib_testcase/test_localcachedir/

      http://integration.moodle.org/job/20.%20Run%20phpunit%20UnitTests%20(master)/1605/testReport/junit/(root)/core_completionlib_testcase/test_update_state/


      Original description

      completionlib_testcase::test_update_state
      Expectation failed for method name is equal to <string:internal_set_data> when invoked at sequence index 2
      Parameter 1 for invocation completion_info::internal_set_data(stdClass Object (...), stdClass Object (...)) does not match expected value.
      Failed asserting that two objects are equal.
      — Expected
      +++ Actual
      @@ @@
      stdClass Object (
      'completionstate' => 0

      • 'timemodified' => 1352192574
        + 'timemodified' => 1352192575
        )

      /Users/Shared/Jenkins/Home/git_repositories/MOODLE_23_STABLE/lib/completionlib.php:524
      /Users/Shared/Jenkins/Home/git_repositories/MOODLE_23_STABLE/lib/tests/completionlib_test.php:162
      /Users/Shared/Jenkins/Home/git_repositories/MOODLE_23_STABLE/lib/phpunit/classes/basic_testcase.php:64

            skodak Petr Skoda (Inactive)
            poltawski Dan Poltawski
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Rajesh Taneja Rajesh Taneja
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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