Skip to content

Commit

Permalink
Set REDIS_URL to use non-default host in test env
Browse files Browse the repository at this point in the history
  • Loading branch information
Tensho committed Dec 6, 2018
1 parent 840a919 commit 1940a5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions test/helper.rb
Expand Up @@ -20,6 +20,8 @@
end
end

ENV['REDIS_URL'] ||= 'redis://localhost/15'

Sidekiq.logger.level = Logger::ERROR

def capture_logging(lvl=Logger::INFO)
Expand Down
4 changes: 2 additions & 2 deletions test/test_redis_connection.rb
Expand Up @@ -82,7 +82,7 @@ def server_connection(*args)
it "disables client setname with nil id" do
pool = Sidekiq::RedisConnection.create(:id => nil)
assert_equal Redis, pool.checkout.class
assert_equal "redis://127.0.0.1:6379/0", pool.checkout.connection.fetch(:id)
assert_equal "redis://localhost:6379/15", pool.checkout.connection.fetch(:id)
end

describe "network_timeout" do
Expand Down Expand Up @@ -124,7 +124,7 @@ def server_connection(*args)
pool = Sidekiq::RedisConnection.create(:path => "/var/run/redis.sock")
assert_equal "unix", client_for(pool.checkout).scheme
assert_equal "/var/run/redis.sock", pool.checkout.connection.fetch(:location)
assert_equal 0, pool.checkout.connection.fetch(:db)
assert_equal 15, pool.checkout.connection.fetch(:db)
end

it "uses a given :path and :db" do
Expand Down

0 comments on commit 1940a5d

Please sign in to comment.