I have a
codeship-services.yml with a web and a db service. In my
codeship-steps.yml I am running two tests (
bundle exec rspec spec/features and
bundle exec rspec spec/controllers) in
parallel. Both require a running
postgres database. Here is what happens: codeships starts up 4 container (2
db) and executes the commands in parallel. But it is not deterministic which database server is used as both answer to
ping db. Due to how rails works with a
database.yml oder via
ENV variables, the
DATABASE_HOST is set to
db. That results in very flaky tests and maybe race conditions?
How does codeship ensure that web(1) always talks do db(1)? Is there some kind of network defined only between containers of step 1? Or do I have to define services per step my self? Or should I set the
DATABASE_HOST inside the step command definition?
I am curious about a proposed/official solution.