deviantintegral / drupal_tests

A docker container based for running Drupal tests in CircleCI
GNU General Public License v3.0
24 stars 9 forks source link

COPY settings.php /var/www #41

Open dakkusingh opened 6 years ago

dakkusingh commented 6 years ago

In Dockerfile: https://github.com/deviantintegral/drupal_tests/blob/master/Dockerfile#L62 We move the settings to outside the HTML folder, is this intentional?

I found some code in test-js.sh https://github.com/deviantintegral/drupal_tests/blob/master/hooks/test-js.sh#L30

its doing:

# Restore and update a previously installed Drupal site.
mv ../settings.php sites/default/

I havent looked too deeply but why not move the settings.php to the correct place to begin with:

COPY settings.php /var/www/sites/default/

and remove this step in test-js.sh https://github.com/deviantintegral/drupal_tests/blob/master/hooks/test-js.sh#L30

deviantintegral commented 6 years ago

As we use a separate mariadb container, a fresh test won't have a database installed. In other words, if we put settings.php in the proper place, it won't be functional because the database still has to be imported. My thinking was that by keeping it out it was more obvious that you have to do something (a drush site-install or database import) if you want a test site.

What do you think? Is there a better way to make that clear?

dakkusingh commented 6 years ago

@deviantintegral Thank you for taking the time & replying through some of my questions, much appreciate you sharing the thought process behind some of the decisions.

I think what we are saying here is 2 things really: 1) database setup and settings.php etc should be neatly self contained. therefore, if you need a DB, you have to instigate a "build" step. 2) I think its worth breaking out the test steps and build steps into their own, where test is dependent on build.

I think it might be worth doing this in Robo..

example:

    protected function buildEnvironment()
    {
        $force = true;
        $tasks = [];
        $tasks[] = $this->taskFilesystemStack()
            ->copy('.travis/docker-compose.yml', 'docker-compose.yml', $force)
            ->copy('.travis/traefik.yml', 'traefik.yml', $force)
            ->copy('.travis/.env', '.env', $force)
            ->copy('.travis/config/settings.local.php',
                'web/sites/default/settings.local.php', $force)
            ->copy('.travis/config/behat.yml', 'tests/behat.yml', $force);
        $tasks[] = $this->taskExec('docker-compose pull --parallel');
        $tasks[] = $this->taskExec('docker-compose up -d');
        return $tasks;
    }
dakkusingh commented 6 years ago

In general, I am quite partial to wrapping up all my tasks in Robo rather than bash.

Here is what I am currently doing for coding standards.. screen shot 2018-03-23 at 5 46 23 pm

happy to work with you in roboising the scripts if thats a direction you see pursuing.