Overriding CircleCI settings to load data from seed and rake tasks.

CircleCI generates its own database.yml for every build. It then creates the database using the newly created database.yml file and loads the schema. It sets the environment to ‘test’ and runs the test cases.

I needed some data that was loaded using seed and a rake task. This data was preserved from truncation between test cases. The problem was that Circle didn’t use migrations and seeding but used schema loading and  hence all the test cases were failing.

To solve the issue, i added a circle.yml to application folder root with the following contents

    - cp config/database.yml.ci config/database.yml
    - bundle exec rake db:create db:migrate db:seed permissions:permissions --trace

config/database.yml.ci is a file that holds my test settings as

   adapter: postgresql
   database: app_test
   pool: 5

permissions:load_permissions is my rake task that loads permissions.

Please refer https://circleci.com/docs/configuration CircleCI configuration

One thought on “Overriding CircleCI settings to load data from seed and rake tasks.

  1. Excellent excited synthetic attention designed for details and
    can anticipate problems just before these people happen.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.