From 1ecdd7e8a7f671825f36217f4d96a90defc7ba88 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Mon, 13 Nov 2017 18:04:37 +0900 Subject: Return a non zero code when can not connect to redis in CI --- activejob/test/support/integration/adapters/resque.rb | 3 ++- activejob/test/support/integration/adapters/sidekiq.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'activejob') diff --git a/activejob/test/support/integration/adapters/resque.rb b/activejob/test/support/integration/adapters/resque.rb index 7d5174b957..cc33878cb9 100644 --- a/activejob/test/support/integration/adapters/resque.rb +++ b/activejob/test/support/integration/adapters/resque.rb @@ -7,7 +7,8 @@ module ResqueJobsManager Resque.logger = Rails.logger unless can_run? puts "Cannot run integration tests for resque. To be able to run integration tests for resque you need to install and start redis.\n" - exit + status = ENV["CI"] ? false : true + exit status end end diff --git a/activejob/test/support/integration/adapters/sidekiq.rb b/activejob/test/support/integration/adapters/sidekiq.rb index ceb7fb61f2..a92e9c4ffe 100644 --- a/activejob/test/support/integration/adapters/sidekiq.rb +++ b/activejob/test/support/integration/adapters/sidekiq.rb @@ -18,7 +18,8 @@ module SidekiqJobsManager ActiveJob::Base.queue_adapter = :sidekiq unless can_run? puts "Cannot run integration tests for sidekiq. To be able to run integration tests for sidekiq you need to install and start redis.\n" - exit + status = ENV["CI"] ? false : true + exit status end end -- cgit v1.2.3 From 8e964556e74925b48e9eb040403a9ebacff1406b Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Mon, 13 Nov 2017 18:06:34 +0900 Subject: Make sidekiq and resque integration tests work in CI Since 8f2490b, the integration test of sidekiq and resque is not working in CI. https://travis-ci.org/rails/rails/jobs/301276197#L2055 https://travis-ci.org/rails/rails/jobs/301276197#L2061 Because 8f2490b removed password from `redis-server`. So must also remove passwords from these tests. --- activejob/test/support/integration/adapters/resque.rb | 2 +- activejob/test/support/integration/adapters/sidekiq.rb | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) (limited to 'activejob') diff --git a/activejob/test/support/integration/adapters/resque.rb b/activejob/test/support/integration/adapters/resque.rb index cc33878cb9..2ed8302277 100644 --- a/activejob/test/support/integration/adapters/resque.rb +++ b/activejob/test/support/integration/adapters/resque.rb @@ -3,7 +3,7 @@ module ResqueJobsManager def setup ActiveJob::Base.queue_adapter = :resque - Resque.redis = Redis::Namespace.new "active_jobs_int_test", redis: Redis.new(url: "redis://:password@127.0.0.1:6379/12", thread_safe: true) + Resque.redis = Redis::Namespace.new "active_jobs_int_test", redis: Redis.new(url: "redis://127.0.0.1:6379/12", thread_safe: true) Resque.logger = Rails.logger unless can_run? puts "Cannot run integration tests for resque. To be able to run integration tests for resque you need to install and start redis.\n" diff --git a/activejob/test/support/integration/adapters/sidekiq.rb b/activejob/test/support/integration/adapters/sidekiq.rb index a92e9c4ffe..4b01a81ec5 100644 --- a/activejob/test/support/integration/adapters/sidekiq.rb +++ b/activejob/test/support/integration/adapters/sidekiq.rb @@ -5,14 +5,6 @@ require "sidekiq/api" require "sidekiq/testing" Sidekiq::Testing.disable! -Sidekiq.configure_server do |config| - config.redis = { url: "redis://:password@127.0.0.1:6379/12" } -end - -Sidekiq.configure_client do |config| - config.redis = { url: "redis://:password@127.0.0.1:6379/12" } -end - module SidekiqJobsManager def setup ActiveJob::Base.queue_adapter = :sidekiq -- cgit v1.2.3 From 8dd76a7a6ff1bb7105beabb8f834ca54ab1e5fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Mon, 13 Nov 2017 15:23:28 -0500 Subject: Use .tt extension to all the template files Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878. --- activejob/lib/rails/generators/job/templates/application_job.rb | 9 --------- .../lib/rails/generators/job/templates/application_job.rb.tt | 9 +++++++++ activejob/lib/rails/generators/job/templates/job.rb | 9 --------- activejob/lib/rails/generators/job/templates/job.rb.tt | 9 +++++++++ 4 files changed, 18 insertions(+), 18 deletions(-) delete mode 100644 activejob/lib/rails/generators/job/templates/application_job.rb create mode 100644 activejob/lib/rails/generators/job/templates/application_job.rb.tt delete mode 100644 activejob/lib/rails/generators/job/templates/job.rb create mode 100644 activejob/lib/rails/generators/job/templates/job.rb.tt (limited to 'activejob') diff --git a/activejob/lib/rails/generators/job/templates/application_job.rb b/activejob/lib/rails/generators/job/templates/application_job.rb deleted file mode 100644 index f93745a31a..0000000000 --- a/activejob/lib/rails/generators/job/templates/application_job.rb +++ /dev/null @@ -1,9 +0,0 @@ -<% module_namespacing do -%> -class ApplicationJob < ActiveJob::Base - # Automatically retry jobs that encountered a deadlock - # retry_on ActiveRecord::Deadlocked - - # Most jobs are safe to ignore if the underlying records are no longer available - # discard_on ActiveJob::DeserializationError -end -<% end -%> diff --git a/activejob/lib/rails/generators/job/templates/application_job.rb.tt b/activejob/lib/rails/generators/job/templates/application_job.rb.tt new file mode 100644 index 0000000000..f93745a31a --- /dev/null +++ b/activejob/lib/rails/generators/job/templates/application_job.rb.tt @@ -0,0 +1,9 @@ +<% module_namespacing do -%> +class ApplicationJob < ActiveJob::Base + # Automatically retry jobs that encountered a deadlock + # retry_on ActiveRecord::Deadlocked + + # Most jobs are safe to ignore if the underlying records are no longer available + # discard_on ActiveJob::DeserializationError +end +<% end -%> diff --git a/activejob/lib/rails/generators/job/templates/job.rb b/activejob/lib/rails/generators/job/templates/job.rb deleted file mode 100644 index 4ad2914a45..0000000000 --- a/activejob/lib/rails/generators/job/templates/job.rb +++ /dev/null @@ -1,9 +0,0 @@ -<% module_namespacing do -%> -class <%= class_name %>Job < ApplicationJob - queue_as :<%= options[:queue] %> - - def perform(*args) - # Do something later - end -end -<% end -%> diff --git a/activejob/lib/rails/generators/job/templates/job.rb.tt b/activejob/lib/rails/generators/job/templates/job.rb.tt new file mode 100644 index 0000000000..4ad2914a45 --- /dev/null +++ b/activejob/lib/rails/generators/job/templates/job.rb.tt @@ -0,0 +1,9 @@ +<% module_namespacing do -%> +class <%= class_name %>Job < ApplicationJob + queue_as :<%= options[:queue] %> + + def perform(*args) + # Do something later + end +end +<% end -%> -- cgit v1.2.3