title: GiLab CI - Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379
body: <p>Few tests are failing in pipeline with error <code>Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)</code>.</p>
  
  <p>My <code>.gitlab-ci.yml</code> file</p>
  
  <pre><code>image: starefossen/ruby-node:latest
  
  services:
    - mongo:latest
    - redis:latest
  
  variables:
    MONGODB_URI: mongodb://mongo:27017/db_test
    REDISTOGO_URL: redis://localhost:6379
  
  before_script:
    - bundle install --path=cache/bundler
    - cp config/mongoid.yml.gitlab config/mongoid.yml
    - RAILS_ENV=test bundle exec rake db:create db:migrate
  
  test:
    script:
     - bundle exec rake test
  </code></pre>
  
  <p>my <code>config/initializers/sidekiq.rb</code> file</p>
  
  <pre><code>require 'sidekiq'
  require 'sidekiq-status'
  
  Sidekiq.configure_client do |config|
    config.redis = { size: 5, url: ENV['REDISTOGO_URL'] }
  end
  
  Sidekiq.configure_server do |config|
    config.server_middleware do |chain|
      chain.add Sidekiq::Throttler, storage: :redis
    end
    config.redis = { size: 10, url: ENV['REDISTOGO_URL'] }
  end
  </code></pre>
  
  <p>can anyone point me the right direction? Thank you</p>