Codeception / Codeception/module-mongodb

Authentication failure on MongoDB

Offen
#5 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
2
Forks
11
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

#### What are you trying to achieve?
I'm trying to use the MongoDB driver module in my tests (using an authentication database locally), but the following exception is generated:

MongoDb: Failed to list collections of the DB: auth failed

#### What do you get instead?

> Provide console output if related. Use `-vvv` mode for more details.

```bash
[Codeception\Exception\ModuleException]
MongoDb: Failed to list collections of the DB: auth failed

Exception trace:
() at /vagrant/api/vendor/codeception/codeception/src/Codeception/Module/MongoDb.php:206
Codeception\Module\MongoDb->cleanup() at /vagrant/api/vendor/codeception/codeception/src/Codeception/Module/MongoDb.php:106
Codeception\Module\MongoDb->_initialize() at /vagrant/api/vendor/codeception/codeception/src/Codeception/SuiteManager.php:80
Codeception\SuiteManager->initialize() at /vagrant/api/vendor/codeception/codeception/src/Codeception/Codecept.php:182
Codeception\Codecept->runSuite() at /vagrant/api/vendor/codeception/codeception/src/Codeception/Codecept.php:153
Codeception\Codecept->run() at /vagrant/api/vendor/codeception/codeception/src/Codeception/Command/Run.php:366
Codeception\Command\Run->runSuites() at /vagrant/api/vendor/codeception/codeception/src/Codeception/Command/Run.php:293
Codeception\Command\Run->execute() at /vagrant/api/vendor/symfony/console/Command/Command.php:265
Symfony\Component\Console\Command\Command->run() at /vagrant/api/vendor/symfony/console/Application.php:826
Symfony\Component\Console\Application->doRunCommand() at /vagrant/api/vendor/symfony/console/Application.php:189
Symfony\Component\Console\Application->doRun() at /vagrant/api/vendor/symfony/console/Application.php:120
Symfony\Component\Console\Application->run() at /vagrant/api/vendor/codeception/codeception/src/Codeception/Application.php:103
Codeception\Application->run() at /vagrant/api/vendor/codeception/codeception/codecept:36
```

### Details

* Codeception version: 2.2.10
* PHP Version: 7.0.17
* Operating System: Ubuntu 16.04.2 LTS (vagrant box)
* Installation type: Composer
* Suite configuration:

```yml
class_name: UnitTester
modules:
enabled: [Asserts, \Helper\Unit, Laravel5, MongoDb]
config:
Laravel5:
environment_file: .env.testing
```

I could fix this issue, by adding an option `'database' => 'admin'` to https://github.com/Codeception/Codeception/blob/2.2/src/Codeception/Lib/Driver/MongoDb.php#L114 `$options` array.
Problem is, that the module won't take into account any additional options, such as authenticationDatabase.

This also affects the mongorestore functionality, which doesn't have support for the `--authenticationDatabase ` option.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with Codeception/Lib/Driver/MongoDb.php around the options array near line 114 and the MongoDb module cleanup path reported at line 206. Reproduce the authenticated local setup, then verify that authenticationDatabase and related options are honored by both normal collection cleanup and mongorestore.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
mongodb, php
Bereich
databases, testing
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.