-
Notifications
You must be signed in to change notification settings - Fork 179
Using non local redis server for tests #184
Comments
Try adding a before block that sets the configuration: before do
registry.config.redis[:host] = "dockerhost"
registry.config.redis[:port] = 12345
end |
Thanks for the tip. I gave it a try and it still attempts to use redis on local host. I even output the config to make sure it is being set properly.
|
Also, it seems weird that Redis is even needed for unit tests. Unit tests should not require external systems. |
@qgriffith did you manage to solve this somehow?! |
Also looking for a solution |
I got a nice suggestion from @atmosx on my mailbox, but somehow it's not showing up here. I think I found out a different way to handle it. I'm trying to build this in GitLab CI, and there it provides redis as a docker service, which means it will be available as This is what I've added to the require 'pry'
require 'simplecov'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
]
SimpleCov.start { add_filter '/spec/' }
require 'lita-queue'
require 'lita/rspec'
# Patch for GitLab CI compatibility
if ENV['GITLAB_CI']
Lita.configure do |config|
config.redis[:host] = 'redis'
end
end
# A compatibility mode is provided for older plugins upgrading from Lita 3. Since this plugin
# was generated with Lita 4, the compatibility mode should be left disabled.
Lita.version_3_compatibility_mode = false By using the conditional there I can still run locally with local redis but when in CI it will use the correct host. |
I am running lita in a docker container that is linked to a another docker container using redis. I have the lita_config.rb setup to use the redis container. Lita itself is using the redis container properly. I am running into a issue when I try to run tests on handlers I have created that also use redis. I have a directory under lita called plugins/. I run rake -t inside that directory to run the test for that handler. It fails because it is trying to use redis on local host. I am assuming the tests are ignoring lita_config.rb and defaulting to local host for redis. Is there a way to make test use a separate redis hosts.
The text was updated successfully, but these errors were encountered: