aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2019-02-06 01:20:06 +1030
committerMatthew Draper <matthew@trebex.net>2019-02-06 01:20:06 +1030
commit287920ca7d06c8f51198ec750d65ba703835b257 (patch)
treefa38811f965fa873d02bc7df3317583ada076ff1 /actioncable
parent44232b485485634d681c60868c619323f882e59f (diff)
downloadrails-287920ca7d06c8f51198ec750d65ba703835b257.tar.gz
rails-287920ca7d06c8f51198ec750d65ba703835b257.tar.bz2
rails-287920ca7d06c8f51198ec750d65ba703835b257.zip
Respect ENV variables when finding DBs etc for the test suite
If they're not set we'll still fall back to localhost, but this makes it possible to run the tests against a remote Postgres / Redis / whatever.
Diffstat (limited to 'actioncable')
-rw-r--r--actioncable/Rakefile4
-rw-r--r--actioncable/test/subscription_adapter/redis_test.rb8
2 files changed, 9 insertions, 3 deletions
diff --git a/actioncable/Rakefile b/actioncable/Rakefile
index 35de50f05a..121037844d 100644
--- a/actioncable/Rakefile
+++ b/actioncable/Rakefile
@@ -1,5 +1,6 @@
# frozen_string_literal: true
+require "base64"
require "rake/testtask"
require "pathname"
require "open3"
@@ -25,7 +26,8 @@ namespace :test do
end
task :integration do
- system("yarn test") || raise("Failures")
+ system(Hash[*Base64.decode64(ENV.fetch("ENCODED", "")).split(/[ =]/)], "yarn", "test")
+ exit($?.exitstatus) unless $?.success?
end
end
diff --git a/actioncable/test/subscription_adapter/redis_test.rb b/actioncable/test/subscription_adapter/redis_test.rb
index ac2d8ef724..35840a4036 100644
--- a/actioncable/test/subscription_adapter/redis_test.rb
+++ b/actioncable/test/subscription_adapter/redis_test.rb
@@ -11,7 +11,11 @@ class RedisAdapterTest < ActionCable::TestCase
include ChannelPrefixTest
def cable_config
- { adapter: "redis", driver: "ruby" }
+ { adapter: "redis", driver: "ruby" }.tap do |x|
+ if host = URI(ENV["REDIS_URL"] || "").hostname
+ x[:host] = host
+ end
+ end
end
end
@@ -25,7 +29,7 @@ class RedisAdapterTest::AlternateConfiguration < RedisAdapterTest
def cable_config
alt_cable_config = super.dup
alt_cable_config.delete(:url)
- alt_cable_config.merge(host: "127.0.0.1", port: 6379, db: 12)
+ alt_cable_config.merge(host: URI(ENV["REDIS_URL"] || "").hostname || "127.0.0.1", port: 6379, db: 12)
end
end