module-db icon indicating copy to clipboard operation
module-db copied to clipboard

Documentation for 'cleanup' configuration option

Open 7118path opened this issue 4 years ago • 3 comments

Hi,

seems like the documentation for the 'cleanup' configuration option ist not correct:

cleanup: false - whether the dump should be reloaded before each test

It think more correct would be:

cleanup: false - whether all database tables should be dropped

I am not quite sure if this dropping happens once or before each test. The docs mention the 'clearing' of the database, but not in connection with this option.

Make this more precise would be great!

7118path avatar Aug 23 '21 09:08 7118path

Actually cleanup does both things - drops all tables and loads the dump file.

Naktibalda avatar Sep 10 '21 05:09 Naktibalda

Documentation:

populate: false - whether the the dump should be loaded before the test suite is started cleanup: false - whether the dump should be reloaded before each test

I had another look today. Multi-DB change back in 2018 made cleanup code really difficult to follow.

I see that cleanup is dependent on populate - if populate is off, then cleanup setting has no effect.

The actual logic is:

public function _beforeSuite()
{
  if ($populate) {
    if ($cleanup) {
      dropAllTables();
    }
    loadDump();
  }
}

public function _before()
{
    if ($cleanup && $populate) {
      dropAllTables();
      loadDump();
  }
}

Also they have additional conditions and only run if either dump file is non-empty or populator setting is set.

populator setting is not mentioned in Config section, but has it's own chapter right after examples.

Naktibalda avatar Sep 11 '21 09:09 Naktibalda

Thank you for having a look and specifying what actually happens.

Maybe the docs for cleanup could be like:

cleanup: false - whether the dump should be reloaded before each test, this includes the dropping of all tables

7118path avatar Sep 20 '21 12:09 7118path