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

Prevent behat test site upgrades

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Start and enable your behat test environment
        • php admin/tool/behat/cli/init.php
      2. Edit your config.php and add $CFG->behat_switchcompletely = true;
      3. php admin/tool/behat/cli/util.php --enable
      4. Access your moodle site URL
      5. You SHOULD see "Acceptance test site"
      6. Login with admin/admin and go to 'Notifications'
      7. You SHOULD see the red message Your site is currently running unstable "Alpha" development code
      8. You SHOULD NOT see any error (print_error typical format I mean)
      9. Log out
      10. Edit version.php and change it to $CFG->version = 201408300.00 for example
      11. Log in
      12. You SHOULD be redirected to admin/index.php
      13. You SHOULD see an error (print_error) stating that the behat test site can not be upgraded like this
      14. Edit your config.php and comment $CFG->behat_switchcompletely = true;
      15. php admin/tool/behat/cli/util.php --enable
      16. Go to your site URL
      17. You SHOULD see your normal site title
      18. Log in
      19. You SHOULD be redirected to admin/index.php and you SHOULD see the normal upgrade page, don't continue
      20. Restore your version.php
      21. Refresh admin/index.php
      22. You SHOULD NOT the normal 'Notifications' page
      Show
      Start and enable your behat test environment php admin/tool/behat/cli/init.php Edit your config.php and add $CFG->behat_switchcompletely = true; php admin/tool/behat/cli/util.php --enable Access your moodle site URL You SHOULD see "Acceptance test site" Login with admin/admin and go to 'Notifications' You SHOULD see the red message Your site is currently running unstable "Alpha" development code You SHOULD NOT see any error (print_error typical format I mean) Log out Edit version.php and change it to $CFG->version = 201408300.00 for example Log in You SHOULD be redirected to admin/index.php You SHOULD see an error (print_error) stating that the behat test site can not be upgraded like this Edit your config.php and comment $CFG->behat_switchcompletely = true; php admin/tool/behat/cli/util.php --enable Go to your site URL You SHOULD see your normal site title Log in You SHOULD be redirected to admin/index.php and you SHOULD see the normal upgrade page, don't continue Restore your version.php Refresh admin/index.php You SHOULD NOT the normal 'Notifications' page
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-41342_master

      Description

      Using $CFG->behat_switchcompletely is easy to upgrade the test site through the web interface rather than upgrading the real moodle site; this should be prevented as the database/dataroot are upgraded, but we store, both in the behat database and in the behat dataroot, a hash with the codebase version which are not updated when upgrading like this.

      We have two options,:

      • Modify the normal upgrade process to let it update both the behat dataroot file and the database record which contains the codebase hash
      • Modify the normal upgrade process to prevent upgrades when the behat database and dataroot are being used

      I would go with the second option to keep all behat utilities as CLI utilities for developers and completely separated from actions that users can perform through web interface

        Attachments

          Activity

            People

            Assignee:
            dmonllao David Monllaó
            Reporter:
            dmonllao David Monllaó
            Peer reviewer:
            Petr Skoda
            Integrator:
            Eloy Lafuente (stronk7)
            Tester:
            Frédéric Massart
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/Nov/13