286f2f0287
This file was introduced in de28930 because the Delayed Job JobWrapper includes an adapter specific method that logs job parameters. Since it was the first adapter specific test file, there was not previously any logic to only run some files for each adapter, so this file was included when running any adapter's tests. This commit excludes the delayed_job specific test file from all of the other adapter test tasks so that they do not require delayed_job and run these tests. de28930: de28930d463e66b886632c560d58bb7459037223
88 lines
2.4 KiB
Ruby
88 lines
2.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "rake/testtask"
|
|
|
|
ACTIVEJOB_ADAPTERS = %w(async inline delayed_job queue_classic resque sidekiq sneakers sucker_punch backburner test)
|
|
ACTIVEJOB_ADAPTERS.delete("queue_classic") if defined?(JRUBY_VERSION)
|
|
|
|
task default: :test
|
|
task test: "test:default"
|
|
|
|
task :package
|
|
|
|
namespace :test do
|
|
desc "Run all adapter tests"
|
|
task :default do
|
|
run_without_aborting ACTIVEJOB_ADAPTERS.map { |a| "test:#{a}" }
|
|
end
|
|
|
|
desc "Run all adapter tests in isolation"
|
|
task :isolated do
|
|
run_without_aborting ACTIVEJOB_ADAPTERS.map { |a| "test:isolated:#{a}" }
|
|
end
|
|
|
|
desc "Run integration tests for all adapters"
|
|
task :integration do
|
|
run_without_aborting (ACTIVEJOB_ADAPTERS - ["test"]).map { |a| "test:integration:#{a}" }
|
|
end
|
|
|
|
task "env:integration" do
|
|
ENV["AJ_INTEGRATION_TESTS"] = "1"
|
|
end
|
|
|
|
ACTIVEJOB_ADAPTERS.each do |adapter|
|
|
task("env:#{adapter}") { ENV["AJ_ADAPTER"] = adapter }
|
|
|
|
Rake::TestTask.new(adapter => "test:env:#{adapter}") do |t|
|
|
t.description = "Run adapter tests for #{adapter}"
|
|
t.libs << "test"
|
|
t.test_files = FileList["test/cases/**/*_test.rb"].reject {
|
|
|x| x.include?("delayed_job") && adapter != "delayed_job"
|
|
}
|
|
t.verbose = true
|
|
t.warning = true
|
|
t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
|
|
end
|
|
|
|
namespace :isolated do
|
|
task adapter => "test:env:#{adapter}" do
|
|
Dir.glob("#{__dir__}/test/cases/**/*_test.rb").reject {
|
|
|x| x.include?("delayed_job") && adapter != "delayed_job"
|
|
}.all? do |file|
|
|
sh(Gem.ruby, "-w", "-I#{__dir__}/lib", "-I#{__dir__}/test", file)
|
|
end || raise("Failures")
|
|
end
|
|
end
|
|
|
|
namespace :integration do
|
|
Rake::TestTask.new(adapter => ["test:env:#{adapter}", "test:env:integration"]) do |t|
|
|
t.description = "Run integration tests for #{adapter}"
|
|
t.libs << "test"
|
|
t.test_files = FileList["test/integration/**/*_test.rb"]
|
|
t.verbose = true
|
|
t.warning = true
|
|
t.ruby_opts = ["--dev"] if defined?(JRUBY_VERSION)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
def run_without_aborting(tasks)
|
|
errors = []
|
|
|
|
tasks.each do |task|
|
|
puts "\n\n--- rake #{task}\n"
|
|
|
|
Rake::Task[task].invoke
|
|
rescue Exception
|
|
puts "\n^^^ +++"
|
|
|
|
errors << task
|
|
end
|
|
|
|
if errors.any?
|
|
puts "\n\n+++ Summary\n"
|
|
abort "Errors running #{errors.join(', ')}"
|
|
end
|
|
end
|