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

Fatal error running mongo cache store tests when backend stopped

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.6.5, 2.7.2
    • 2.6.6, 2.7.3
    • Caching
    • MOODLE_26_STABLE, MOODLE_27_STABLE
    • MOODLE_26_STABLE, MOODLE_27_STABLE
    • 47608-28
    • Hide

      Start the mongo service before running unit tests.

      Show
      Start the mongo service before running unit tests.
    • Easy
    • 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.

    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

            samhemelryk Sam Hemelryk
            samhemelryk Sam Hemelryk
            Dan Poltawski Dan Poltawski
            Frédéric Massart Frédéric Massart
            Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10/Nov/14