aboutsummaryrefslogtreecommitdiffstats
path: root/railties/Rakefile
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 /railties/Rakefile
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 'railties/Rakefile')
-rw-r--r--railties/Rakefile21
1 files changed, 17 insertions, 4 deletions
diff --git a/railties/Rakefile b/railties/Rakefile
index 445f6217b3..1c4725e2d6 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -36,10 +36,20 @@ namespace :test do
dirs = (ENV["TEST_DIR"] || ENV["TEST_DIRS"] || "**").split(",")
test_options = ENV["TESTOPTS"].to_s.split(/[\s]+/)
- test_files = dirs.map { |dir| "test/#{dir}/*_test.rb" }
- Dir[*test_files].each do |file|
- next true if file.start_with?("test/fixtures/")
+ test_patterns = dirs.map { |dir| "test/#{dir}/*_test.rb" }
+ test_files = Dir[*test_patterns].select do |file|
+ !file.start_with?("test/fixtures/")
+ end.sort
+ if ENV["BUILDKITE_PARALLEL_JOB_COUNT"]
+ n = ENV["BUILDKITE_PARALLEL_JOB"].to_i
+ m = ENV["BUILDKITE_PARALLEL_JOB_COUNT"].to_i
+
+ test_files = test_files.each_slice(m).map { |slice| slice[n] }.compact
+ end
+
+ test_files.each do |file|
+ puts "--- #{file}"
fake_command = Shellwords.join([
FileUtils::RUBY,
"-w",
@@ -59,10 +69,13 @@ namespace :test do
unless $?.success?
failing_files << file
+ puts "^^^ +++"
end
end
+ puts "--- All tests completed"
unless failing_files.empty?
+ puts "^^^ +++"
puts
puts "Failed in:"
failing_files.each do |file|
@@ -70,7 +83,7 @@ namespace :test do
end
puts
- raise "Failure in isolated test runner"
+ exit 1
end
end
end