Fix problems in unit tests where DB access was attempted before DB was ready #13
15
.github/workflows/tests.yml
vendored
15
.github/workflows/tests.yml
vendored
@ -13,11 +13,6 @@ jobs:
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
ports:
|
||||
- 5432
|
||||
steps:
|
||||
@ -26,8 +21,16 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: ruby/setup-ruby@v1
|
||||
- run: bundle install
|
||||
- name: Wait until Postgres is ready to accept connections
|
||||
run: |
|
||||
apt-get update && apt-get install -f -y postgresql-client
|
||||
until pg_isready -h postgres -U postgres -d postgres
|
||||
do
|
||||
sleep 1
|
||||
echo "Trying again"
|
||||
done
|
||||
- run: |
|
||||
bundle exec rake db:create db:schema:load
|
||||
bundle exec rake db:schema:load
|
||||
bundle exec rspec
|
||||
env:
|
||||
RAILS_ENV: test
|
||||
|
Loading…
x
Reference in New Issue
Block a user