Redis and ResqueΒΆ

Solano CI sets up an isolated Redis instance for each parallel test worker. The tddium:redis_hook is run once for each redis instance. Note that the soulmate gem does not support the same set of configuration syntaxes as Resque; in particular it does not support the host:port:db syntax so you may need to translate the configuration to redis://host:port/db in your configuration and initialization code.

The Redis configuration is written to config/redis.yml:

# config/redis.yml
test: &test
  :host: <%= ENV['TDDIUM_REDIS_HOST'] %>
  :port: <%= ENV['TDDIUM_REDIS_PORT'] %>
  :db: <%= ENV['TDDIUM_REDIS_DB'] %>
  :password: <%= ENV['TDDIUM_REDIS_PASSWORD'] %>
  :timeout: 10

If your redis initializer doesn’t process config/redis.yml with ERB, or it configures using a different model (e.g., if you use a service like RedisToGo with Heroku), you’ll need to update it. For example:

# config/initializers/redis.rb
  redis = YAML.load('config/redis.yml')).result)[Rails.env]
  uri = URI.parse(ENV['REDISTOGO_URL'] || 'redis://')
  REDIS = =>, :port => uri.port, :password => uri.password)

If you only use Redis for Resque, Solano CI also writes config/resque.yml in the format that Resque expects. It still needs to be ERB interpolated:

# config/resque.yml

Here’s an example resque initializer:

# config/initalizers/resque.rb
resque_config = YAML.load('config','resque.yml'))).result)
Resque.redis = resque_config[Rails.env]