Moodle
  1. Moodle
  2. MDL-41402

Automate large site generation for testing

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.6
    • Component/s: Performance
    • Labels:
    • Testing Instructions:
      Hide
      1. Run the courses generator to ensure there are no regressions
        1. cd /moodle/dirroot
        2. *php admin/tool/generator/cli/maketestcourse.php --size="S" --shortname="whatever_1"
        3. A new course with shortname whatever_1 SHOULD be created and you SHOULD see quite a few outputs in the CLI
        4. Run maketestcourse.php (same command as described above) but now with the --quiet option and changing the --shortname option's value
        5. A new course with shortname "whateveryouused" SHOULD be created and you SHOULD NOT see outputs in the CLI
        6. Use the web interface to create a new course accessing admin/tool/generator/maketestcourse.php being logged as an admin (or Site administration -> Development -> Make test course)
        7. A new course SHOULD be created and you SHOULD NOT see any error
      1. Run the site generator
        1. cd /moodle/dirroot/
        2. php admin/tool/generator/cli/maketestsite.php --size="XS"
        3. There SHOULD be 3 new courses, two with name Test course: XS and another one with name Test course: S
        4. Check the new Test course: S course's contents, the page activities SHOULD be spread across all sections or most of them (is random)
        5. php admin/tool/generator/cli/maketestsite.php --size="XS" --fixeddataset
        6. There SHOULD be 3 new courses, two with name Test course: XS and another one with name Test course: S
        7. Check the new Test course: S course's contents, the page activities SHOULD be in the first topic's section
        8. php admin/tool/generator/cli/maketestsite.php --size="XS" --quiet
        9. You SHOULD NOT see any output in the CLI
        10. There SHOULD be 3 new courses, two with name Test course: XS and another one with name Test course: S
        11. php admin/tool/generator/cli/maketestsite.php --size="S"
        12. There SHOULD be 12 new courses, 8 with name Test course: XS and 4 with name Test course: S
      Show
      Run the courses generator to ensure there are no regressions cd /moodle/dirroot *php admin/tool/generator/cli/maketestcourse.php --size="S" --shortname="whatever_1" A new course with shortname whatever_1 SHOULD be created and you SHOULD see quite a few outputs in the CLI Run maketestcourse.php (same command as described above) but now with the --quiet option and changing the --shortname option's value A new course with shortname "whateveryouused" SHOULD be created and you SHOULD NOT see outputs in the CLI Use the web interface to create a new course accessing admin/tool/generator/maketestcourse.php being logged as an admin (or Site administration -> Development -> Make test course) A new course SHOULD be created and you SHOULD NOT see any error Run the site generator cd /moodle/dirroot/ php admin/tool/generator/cli/maketestsite.php --size="XS" There SHOULD be 3 new courses, two with name Test course: XS and another one with name Test course: S Check the new Test course: S course's contents, the page activities SHOULD be spread across all sections or most of them (is random) php admin/tool/generator/cli/maketestsite.php --size="XS" --fixeddataset There SHOULD be 3 new courses, two with name Test course: XS and another one with name Test course: S Check the new Test course: S course's contents, the page activities SHOULD be in the first topic's section php admin/tool/generator/cli/maketestsite.php --size="XS" --quiet You SHOULD NOT see any output in the CLI There SHOULD be 3 new courses, two with name Test course: XS and another one with name Test course: S php admin/tool/generator/cli/maketestsite.php --size="S" There SHOULD be 12 new courses, 8 with name Test course: XS and 4 with name Test course: S
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-41402_master

      Description

      Following MDL-38197 which generates a test course we can generate a big test site with many courses, users, enrolments and module instances

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            David Monllaó added a comment -

            I wanted to add unit tests for this but would be hard AFAIK, as tool_generator_site_backend::make() is executing system calls which probably is not good when running unit tests.

            Show
            David Monllaó added a comment - I wanted to add unit tests for this but would be hard AFAIK, as tool_generator_site_backend::make() is executing system calls which probably is not good when running unit tests.
            Hide
            David Monllaó added a comment -

            grrrr, working in MDL-41421 I realized that size_for_name() should belong to backend class...

            Note for PR: Updating patch with this single change

            Show
            David Monllaó added a comment - grrrr, working in MDL-41421 I realized that size_for_name() should belong to backend class... Note for PR: Updating patch with this single change
            Hide
            Frédéric Massart added a comment -

            Hi David,

            Abstract

            1. L79 You don't need global $CFG

            Course

            1. L126 I don't like this function... it looks super hacky. I know, you didn't introduce it.

            Site

            1. L38 Could you add some more PHP Doc to $sitecourses so that it is more readable? What is XS, etc...
            2. L84 I still don't like that function lol. Should it use shortsize_ by the way?
            3. L145 If you say that this is the right way, I accept it, but it looks strange to me to call a CLI. In any case, could you add a lock in the API itself that ensures that we are in CLI_SCRIPT. That will prevent some developers to do silly things I guess.
            4. L189 Do you need the % before the string?

            CLI

            1. Use _DIR_ instead of dirname(_FILE_)
            2. L69 Use $CFG->debugdeveloper instead of debugging('', DEBUG_DEVELOPER);

            Overall looks good, thanks David!

            Cheers,
            Fred

            Show
            Frédéric Massart added a comment - Hi David, Abstract L79 You don't need global $CFG Course L126 I don't like this function... it looks super hacky. I know, you didn't introduce it. Site L38 Could you add some more PHP Doc to $sitecourses so that it is more readable? What is XS, etc... L84 I still don't like that function lol. Should it use shortsize_ by the way? L145 If you say that this is the right way, I accept it, but it looks strange to me to call a CLI. In any case, could you add a lock in the API itself that ensures that we are in CLI_SCRIPT. That will prevent some developers to do silly things I guess. L189 Do you need the % before the string? CLI Use _ DIR _ instead of dirname(_ FILE _) L69 Use $CFG->debugdeveloper instead of debugging('', DEBUG_DEVELOPER); Overall looks good, thanks David! Cheers, Fred
            Hide
            David Monllaó added a comment -

            Thanks Fred, I changed most of what you commented about, just kept get_size_choices() as it was, it does his job and the name is appropiate according to it (to get a dropdown menu options) but, in fact, it was never used as there is no web interface for this feature is used by the other two features with web interface; now it is being used in the CLI command help message with a warning about how much data can this tool generate.

            Show
            David Monllaó added a comment - Thanks Fred, I changed most of what you commented about, just kept get_size_choices() as it was, it does his job and the name is appropiate according to it (to get a dropdown menu options) but, in fact, it was never used as there is no web interface for this feature is used by the other two features with web interface; now it is being used in the CLI command help message with a warning about how much data can this tool generate.
            Hide
            David Monllaó added a comment -

            I haven't changed the tool_plugin version, I see that, as there are new language strings, we need to purge cache otherwise we see a debugging message about an unexisting text string and the autoloader reports it as a

            Fatal error: Class 'tool_generator_site_backend' not found in /home/davidm/Desktop/moodlecode/master/admin/tool/generator/cli/maketestsite.php on line 45
            

            Show
            David Monllaó added a comment - I haven't changed the tool_plugin version, I see that, as there are new language strings, we need to purge cache otherwise we see a debugging message about an unexisting text string and the autoloader reports it as a Fatal error: Class 'tool_generator_site_backend' not found in /home/davidm/Desktop/moodlecode/master/admin/tool/generator/cli/maketestsite.php on line 45
            Hide
            Dan Poltawski added a comment -

            Thanks David - i've integrated it to master

            Show
            Dan Poltawski added a comment - Thanks David - i've integrated it to master
            Hide
            Adrian Greeve added a comment -

            I followed all of the instructions and the output was exactly as described.
            No problems found.
            Test passed.

            Show
            Adrian Greeve added a comment - I followed all of the instructions and the output was exactly as described. No problems found. Test passed.
            Hide
            Dan Poltawski added a comment -

            Congratulations! This change has been integrated upstream and is now available from our git and download mirrors. To celebrate, here is a joke:

            A SQL query goes into a bar, walks up to two tables and asks, "Can I join you?"

            Show
            Dan Poltawski added a comment - Congratulations! This change has been integrated upstream and is now available from our git and download mirrors. To celebrate, here is a joke: A SQL query goes into a bar, walks up to two tables and asks, "Can I join you?"

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: