i have read a lot of answers in forums about this question but noone gives me solution. I want to run rspec on gitlab-ci but every time get an error
could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432? could not connect to server: Cannot assign requested address Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? Couldn't create database for {"adapter"=>"postgresql", "pool"=>5, "timeout"=>5000, "host"=>"localhost", "database"=>"test_vibly", "user"=>"here's my username", "password"=>here's my password} rake aborted!
absolutely 100% that postgres server is running on my machine
tcp4 0 0 127.0.0.1.5432 . LISTEN
tcp6 0 0 fe80::1%lo0.5432 . LISTEN
tcp6 0 0 ::1.5432 . LISTEN
- brew services list:
Name Status User Plist
mongodb stopped
postgresql started rubyguy /Users/rubyguy/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
gitlab-ci.yml file
services: - postgres:latest variables: POSTGRES_DB: vibly POSTGRES_USER: <%= ENV["DB_USER"] %> POSTGRES_PASSWORD: <%= ENV["DB_PASSWORD"] %> rspec: stage: test image: g3dinua/node-ruby:2.3.3 script: - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' - apt-get update -y && apt-get install -y locales mysql-client - echo "en_US UTF-8" > /etc/locale.gen - locale-gen en_US.UTF-8 - export LANG=en_US.UTF-8 - export LANGUAGE=en_US:en - export LC_ALL=en_US.UTF-8 - mkdir -p /cache/bin - ruby -v - gem install bundler - 'bundle_path=$(which bundle)' - bundle install --jobs $(nproc) --path=/cache/bundler - "RAILS_ENV=test bundle exec rake db:create --trace" - "RAILS_ENV=test bundle exec rake db:schema:load --trace" - "RAILS_ENV=test bundle exec rake db:test:prepare --trace" - "RAILS_ENV=test bundle exec rspec spec/" tags: - ruby