diff options
author | Matthew Draper <matthew@trebex.net> | 2014-09-27 21:55:03 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-09-27 21:59:10 +0930 |
commit | d7a058f785224a3643244686fae3a31e408f0860 (patch) | |
tree | 895b051a7d587c3cf204ba7730a99c5d14e9d6ba /activejob/test | |
parent | d13b75bc2647699e5d82a246d17ca9513baf8d9e (diff) | |
download | rails-d7a058f785224a3643244686fae3a31e408f0860.tar.gz rails-d7a058f785224a3643244686fae3a31e408f0860.tar.bz2 rails-d7a058f785224a3643244686fae3a31e408f0860.zip |
Make AJ integration tests much less verbose
In passing, avoid a blind retry in QC: instead, just fix the problem.
Diffstat (limited to 'activejob/test')
8 files changed, 14 insertions, 26 deletions
diff --git a/activejob/test/support/integration/adapters/delayed_job.rb b/activejob/test/support/integration/adapters/delayed_job.rb index dbd0d1a4db..0b591964bc 100644 --- a/activejob/test/support/integration/adapters/delayed_job.rb +++ b/activejob/test/support/integration/adapters/delayed_job.rb @@ -10,7 +10,7 @@ module DelayedJobJobsManager end def start_workers - @worker = Delayed::Worker.new(quiet: false, sleep_delay: 0.5, queues: %w(integration_tests)) + @worker = Delayed::Worker.new(quiet: true, sleep_delay: 0.5, queues: %w(integration_tests)) @thread = Thread.new { @worker.start } end diff --git a/activejob/test/support/integration/adapters/que.rb b/activejob/test/support/integration/adapters/que.rb index a5b9b3ec0a..ba7657a42a 100644 --- a/activejob/test/support/integration/adapters/que.rb +++ b/activejob/test/support/integration/adapters/que.rb @@ -2,12 +2,12 @@ module QueJobsManager def setup require 'sequel' ActiveJob::Base.queue_adapter = :que - que_url = ENV['QUE_DATABASE_URL'] || 'postgres://localhost/active_jobs_que_int_test' + que_url = ENV['QUE_DATABASE_URL'] || 'postgres:///active_jobs_que_int_test' uri = URI.parse(que_url) user = uri.user||ENV['USER'] pass = uri.password db = uri.path[1..-1] - %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'drop database "#{db}"' -U #{user} -t template1} + %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'drop database if exists "#{db}"' -U #{user} -t template1} %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'create database "#{db}"' -U #{user} -t template1} Que.connection = Sequel.connect(que_url) Que.migrate! diff --git a/activejob/test/support/integration/adapters/queue_classic.rb b/activejob/test/support/integration/adapters/queue_classic.rb index 81d1935132..038473ccdc 100644 --- a/activejob/test/support/integration/adapters/queue_classic.rb +++ b/activejob/test/support/integration/adapters/queue_classic.rb @@ -1,12 +1,12 @@ module QueueClassicJobsManager def setup - ENV['QC_DATABASE_URL'] ||= 'postgres://localhost/active_jobs_qc_int_test' + ENV['QC_DATABASE_URL'] ||= 'postgres:///active_jobs_qc_int_test' ENV['QC_LISTEN_TIME'] = "0.5" uri = URI.parse(ENV['QC_DATABASE_URL']) user = uri.user||ENV['USER'] pass = uri.password db = uri.path[1..-1] - %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'drop database "#{db}"' -U #{user} -t template1} + %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'drop database if exists "#{db}"' -U #{user} -t template1} %x{#{"PGPASSWORD=\"#{pass}\"" if pass} psql -c 'create database "#{db}"' -U #{user} -t template1} ActiveJob::Base.queue_adapter = :queue_classic QC::Setup.create @@ -17,23 +17,11 @@ module QueueClassicJobsManager def clear_jobs QC::Queue.new("integration_tests").delete_all - retried = false - rescue => e - puts "Got exception while trying to clear jobs: #{e.inspect}" - if retried - puts "Already retried. Raising exception" - raise e - else - puts "Retrying" - retried = true - QC::Conn.connection = QC::Conn.connect - retry - end end def start_workers + QC::Conn.disconnect @pid = fork do - QC::Conn.connection = QC::Conn.connect worker = QC::Worker.new(q_name: 'integration_tests') worker.start end diff --git a/activejob/test/support/integration/adapters/resque.rb b/activejob/test/support/integration/adapters/resque.rb index 03ffd3fd62..9de3e7c879 100644 --- a/activejob/test/support/integration/adapters/resque.rb +++ b/activejob/test/support/integration/adapters/resque.rb @@ -17,13 +17,15 @@ module ResqueJobsManager def start_workers @resque_thread = Thread.new do - Resque::Worker.new("integration_tests").work(0.5) + w = Resque::Worker.new("integration_tests") + w.term_child = true + w.work(0.5) end @scheduler_thread = Thread.new do Resque::Scheduler.configure do |c| c.poll_sleep_amount = 0.5 c.dynamic = true - c.verbose = true + c.quiet = true c.logfile = nil end Resque::Scheduler.master_lock.release! diff --git a/activejob/test/support/integration/adapters/sidekiq.rb b/activejob/test/support/integration/adapters/sidekiq.rb index b3c3dcff22..0a0a549c9e 100644 --- a/activejob/test/support/integration/adapters/sidekiq.rb +++ b/activejob/test/support/integration/adapters/sidekiq.rb @@ -29,7 +29,6 @@ module SidekiqJobsManager "--concurrency", "1", "--timeout", "1", "--daemon", - "--verbose" ]) require 'celluloid' require 'sidekiq/scheduled' diff --git a/activejob/test/support/integration/adapters/sucker_punch.rb b/activejob/test/support/integration/adapters/sucker_punch.rb index 691ba35c90..9c0d66b469 100644 --- a/activejob/test/support/integration/adapters/sucker_punch.rb +++ b/activejob/test/support/integration/adapters/sucker_punch.rb @@ -1,5 +1,6 @@ module SuckerPunchJobsManager def setup ActiveJob::Base.queue_adapter = :sucker_punch + SuckerPunch.logger = nil end end diff --git a/activejob/test/support/integration/dummy_app_template.rb b/activejob/test/support/integration/dummy_app_template.rb index 28aae0f884..65994d6a1c 100644 --- a/activejob/test/support/integration/dummy_app_template.rb +++ b/activejob/test/support/integration/dummy_app_template.rb @@ -1,5 +1,5 @@ if ENV['AJADAPTER'] == 'delayed_job' - generate "delayed_job:active_record" + generate "delayed_job:active_record", "--quiet" rake("db:migrate") end diff --git a/activejob/test/support/integration/helper.rb b/activejob/test/support/integration/helper.rb index ccd5036b36..9bd45e09e8 100644 --- a/activejob/test/support/integration/helper.rb +++ b/activejob/test/support/integration/helper.rb @@ -1,6 +1,4 @@ -puts "\n\n" -puts "*** Running integration tests for #{ENV['AJADAPTER']} ***" -puts "\n\n" +puts "*** rake aj:integration:#{ENV['AJADAPTER']} ***\n" ENV["RAILS_ENV"] = "test" ActiveJob::Base.queue_name_prefix = nil @@ -10,7 +8,7 @@ require 'rails/generators/rails/app/app_generator' dummy_app_path = Dir.mktmpdir + "/dummy" dummy_app_template = File.expand_path("../dummy_app_template.rb", __FILE__) args = Rails::Generators::ARGVScrubber.new(["new", dummy_app_path, "--skip-gemfile", "--skip-bundle", - "--skip-git", "--skip-spring", "-d", "sqlite3", "--skip-javascript", "--force", "--quite", + "--skip-git", "--skip-spring", "-d", "sqlite3", "--skip-javascript", "--force", "--quiet", "--template", dummy_app_template]).prepare! Rails::Generators::AppGenerator.start args |