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

Fatal error running mongo cache store tests when backend stopped

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.5, 2.7.2
    • Fix Version/s: 2.6.6, 2.7.3
    • Component/s: Caching
    • Labels:
    • Testing Instructions:
      Hide
      1. Install Mongo and stop the service (sudo apt-get install php5-mongo)
      2. Stop the Mongo service
      3. Add define('TEST_CACHESTORE_MONGODB_TESTSERVER', 'mongodb://127.0.0.1:27017'); to your config.php file
      4. Run vendor/bin/phpunit cache/stores/mongodb/tests/mongodb_test.php
      5. Check that you get skipped tests and no fatal errors.
      6. Start the mongo service
      7. Re-run the tests and ensure they all pass.
      Show
      Install Mongo and stop the service (sudo apt-get install php5-mongo) Stop the Mongo service Add define('TEST_CACHESTORE_MONGODB_TESTSERVER', 'mongodb://127.0.0.1:27017'); to your config.php file Run vendor/bin/phpunit cache/stores/mongodb/tests/mongodb_test.php Check that you get skipped tests and no fatal errors. Start the mongo service Re-run the tests and ensure they all pass.
    • Workaround:
      Hide

      Start the mongo service before running unit tests.

      Show
      Start the mongo service before running unit tests.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull Master Branch:
      47608-28
    • Pull Master Diff URL:

      Description

      If you configure Moodle to run MongoDB cache_store tests and then attempt to run the tests before starting the Mongo service you get a fatal error.

      vendor/bin/phpunit cache/stores/mongodb/tests/mongodb_test.php
      Moodle 2.8dev (Build: 20141002), pgsql, 71900d9202b9315c958c8326725b74e4b096454b
      PHPUnit 3.7.37 by Sebastian Bergmann.

      Configuration read from /var/www/integration/phpunit.xml

      PHP Fatal error: Call to a member function selectDB() on a non-object in /var/www/integration/cache/stores/mongodb/lib.php on line 206

      Fatal error: Call to a member function selectDB() on a non-object in /var/www/integration/cache/stores/mongodb/lib.php on line 206

      The mongodb test need to be amended to check the store is ready before tying to use it.

        Attachments

          Activity

            People

            • Assignee:
              samhemelryk Sam Hemelryk
              Reporter:
              samhemelryk Sam Hemelryk
              Integrator:
              Dan Poltawski
              Tester:
              Frédéric Massart
              Participants:
              Component watchers:
              Matteo Scaramuccia, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Nov/14