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

Re-factor fragile mobile tool "potential config issues" test

XMLWordPrintable

      Started happening frequently recently that we have the following failure, consistently reproduced locally (both PHP 7.4 & PHP 8.0):

      $ bin/moodle-docker-compose exec webserver vendor/bin/phpunit admin/tool/mobile/tests/api_test.php --filter test_get_potential_config_issues
      Moodle 4.2dev (Build: 20230105), b8b905cd90f7a1d0db59a70a32d47e015dcfbfea
      Php: 7.4.33, mysqli: 5.7.40, OS: Linux 4.15.0-201-generic x86_64
      PHPUnit 9.5.26 by Sebastian Bergmann and contributors.
       
      F                                                                   1 / 1 (100%)
       
      Time: 00:16.874, Memory: 60.50 MB
       
      There was 1 failure:
       
      1) tool_mobile\api_test::test_get_potential_config_issues
      Failed asserting that actual size 3 matches expected size 2.
       
      /var/www/html/admin/tool/mobile/tests/api_test.php:74
      /var/www/html/lib/phpunit/classes/advanced_testcase.php:80
       
      FAILURES!
      Tests: 1, Assertions: 1, Failures: 1.
      

      Also frequently seen on GHA (sorry for picking lameze's issue ), e.g.

      1. https://github.com/lameze/moodle/actions/runs/3879580574
      2. https://github.com/lameze/moodle/actions/runs/3879606305
      3. https://github.com/lameze/moodle/actions/runs/3879607003
      4. https://github.com/lameze/moodle/actions/runs/3879608114

      The problem is that the test method is receiving back selfsignedoruntrustedcertificatewarning as a "potential config issue" because of this check: https://github.com/moodle/moodle/blob/b8b905cd90f7a1d0db59a70a32d47e015dcfbfea/admin/tool/mobile/classes/api.php#L632-L639

      We're sending a HEAD request to https://www.example.com which makes no sense, and is in no way under our control what this domain should/should not return

            pholden Paul Holden
            pholden Paul Holden
            Juan Leyva Juan Leyva
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 5 minutes
                1h 5m

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