Set database based on how the application was started
Posted
by AaronThomson
on Stack Overflow
See other posts from Stack Overflow
or by AaronThomson
Published on 2010-05-20T01:33:09Z
Indexed on
2010/05/20
1:40 UTC
Read the original article
Hit count: 244
I have two Rails applications (lets call them APP-1 and APP-2), each of them has a dependancy on a third Rails application (APP-3).
I would like to be able to run the tests for APP-1 and APP-2 in parallel on my CI server. The problem is, both need to start up APP-3 and write to a DB via the APP-3. This causes conflicts and failures if the tests are run in parallel.
My idea for a solution is for APP-1 and APP-2 to each start their own instance of APP-3 and to have each instance point to a different DB. Is there a way to dynamically set the DB in the database.yml of APP-3 so that it connects to a different DB depending on which APP starts it up?
FYI. APP-1 and APP-2 currently start APP-3 via rake tasks.
© Stack Overflow or respective owner