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

Behat failures when $CFG->skiplangupgrade is enabled / lang packs don't exist yet

    XMLWordPrintable

Details

    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_400_STABLE
    • MDL-74512_400
    • Hide

      Prerequisites

      1. Ensure that your config.php file has the following code:

        // Skip language upgrade during the on-sync period.
        $CFG->skiplangupgrade = false;
         
        // Enable tests needing language install/upgrade
        // only if we have language upgrades enabled (aka,
        // when we aren't skipping them).
        if (empty($CFG->skiplangupgrade)) {
            define('TOOL_LANGIMPORT_REMOTE_TESTS', true);
        }
        

      MOODLE_400_STABLE tests

      Skipping lang upgrades.

      1. Switch to the MOODLE_400_STABLE branch.
      2. Edit the config.php file and set $CFG->skiplangupgrade = true;.
      3. Init behat.
      4. Run behat with --name='/language (packs|selector)/'
      5. Verify that the execution ends ok, will all the tests being skipped.

      Enabling lang upgrades.

      1. Switch to the MOODLE_400_STABLE branch.
      2. Edit the config.php file and set $CFG->skiplangupgrade = false;.
      3. Init behat.
      4. Run behat with --name='/language (packs|selector)/'
      5. Verify that the execution ends ok, will all the tests being executed and passing.

      master tests

      Skipping lang upgrades.

      1. Switch to the master branch.
      2. Edit the config.php file and set $CFG->skiplangupgrade = true;.
      3. Init behat.
      4. Run behat with --name='/language (packs|selector)/'
      5. Verify that the execution ends ok, will all the tests being skipped.

      Enabling lang upgrades.

      1. Switch to the master branch.
      2. Edit the config.php file and set $CFG->skiplangupgrade = false;.
      3. Init behat.
      4. Run behat with --name='/language (packs|selector)/'
      5. Verify that the execution ends with error, will all the tests being executed and failing. (this failure is normal because the 4.1 (master) lang packs don't exist yet).
      Show
      Prerequisites Ensure that your config.php file has the following code: // Skip language upgrade during the on-sync period. $CFG->skiplangupgrade = false;   // Enable tests needing language install/upgrade // only if we have language upgrades enabled (aka, // when we aren't skipping them). if (empty($CFG->skiplangupgrade)) { define('TOOL_LANGIMPORT_REMOTE_TESTS', true); } MOODLE_400_STABLE tests Skipping lang upgrades. Switch to the MOODLE_400_STABLE branch. Edit the config.php file and set $CFG->skiplangupgrade = true; . Init behat. Run behat with --name='/language (packs|selector)/' Verify that the execution ends ok, will all the tests being skipped . Enabling lang upgrades. Switch to the MOODLE_400_STABLE branch. Edit the config.php file and set $CFG->skiplangupgrade = false; . Init behat. Run behat with --name='/language (packs|selector)/' Verify that the execution ends ok, will all the tests being executed and passing . master tests Skipping lang upgrades. Switch to the master branch. Edit the config.php file and set $CFG->skiplangupgrade = true; . Init behat. Run behat with --name='/language (packs|selector)/' Verify that the execution ends ok, will all the tests being skipped . Enabling lang upgrades. Switch to the master branch. Edit the config.php file and set $CFG->skiplangupgrade = false; . Init behat. Run behat with --name='/language (packs|selector)/' Verify that the execution ends with error, will all the tests being executed and failing . (this failure is normal because the 4.1 (master) lang packs don't exist yet).

    Description

      Part of the release process, we apply to disable language upgrades because the new branches, just created, don't have lang packs yet.

      Normally, that's done with $CFG->skiplangupgrade = true and that is enough to prevent the "upgrade langs" task to be run by cron (and fail).

      But it seems that, in 400 and master, there are some new behat scenarios that require the language upgrades to happen, in order to verify various things in the laguage menus presented to the user.

      The failing scenarios are:

      • Test login language selector (1 scenario)
      • Language selector menu (5 scenarios)

      Link: https://ci.moodle.org/job/W400.04.01%20-%20Behat%20-%20Firefox%20+%20Postgres/1/

      Surely, those scenarios should be skipped, and, maybe that can be done by:

      1. defining the TOOL_LANGIMPORT_REMOTE_TESTS constant when $CFG->skiplangupgrade is NOT set (in config.php template of moodle-ci-runner). Borrowed from my local config.php template, I've this:

        // Disable lang updates on upgrade
        $CFG->skiplangupgrade = true;
        if (empty($CFG->skiplangupgrade)) {
            // Define it only if we aren't skipping lang upgrade (grrr, hate negatives)
            define('TOOL_LANGIMPORT_REMOTE_TESTS', true);
        }
        

      2. adding the "Given remote langimport tests are enabled" step the very first to the scenarios, that looks exactly for that constant, so they are just skipped when lang upgrades are disabled.

      That way the constant will be set normally when the langs are available (and the scenarios will run). And when the langs are not available, the constant won't be set and the scenarios will be skipped.

      Ciao

      Attachments

        Activity

          People

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Victor Déniz Falcón Victor Déniz Falcón
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Gladys Basiana Gladys Basiana
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo, Aya Saad, David Mudrák (@mudrd8mz), Helen Foster, Victor Déniz Falcón
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9/May/22

              Time Tracking

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