aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #30622 from aidanharan/custom-discarded-job-handlingRafael França2018-01-232-0/+9
|\ | | | | Allow for custom handling of exceptions that are discarded
| * Merge branch 'master' into custom-discarded-job-handlingAidan Haran2017-12-098-22/+19
| |\
| * | Allow for custom handling of exceptions that are discardedAidan Haran2017-09-162-0/+9
| | |
* | | Explicitly require `sidekiq/cli`yuuji.yaginuma2017-12-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, sidekiq integration test + Ruby 2.5.0-rc1 show exception as follows. ``` #<Thread:0x000000000670bec0@/home/travis/build/rails/rails/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.0.5/lib/sidekiq/util.rb:23 run> terminated with exception (report_on_exception is true): /home/travis/build/rails/rails/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.1.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `block in load_missing_constant': uninitialized constant Sidekiq::CLI (NameError) from /home/travis/build/rails/rails/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.1.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache' from /home/travis/build/rails/rails/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.1.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `rescue in load_missing_constant' from /home/travis/build/rails/rails/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.1.7/lib/bootsnap/load_path_cache/core_ext/active_support.rb:42:in `load_missing_constant' from /home/travis/build/rails/rails/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.0.5/lib/sidekiq/launcher.rb:65:in `heartbeat' from /home/travis/build/rails/rails/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.0.5/lib/sidekiq/launcher.rb:123:in `start_heartbeat' ``` https://travis-ci.org/rails/rails/jobs/317187279#L2152 The reason for this is that `Sidekiq::CLI` has not been loaded. Sidekiq integration test launches a Sidekiq instance within another Ruby process. In such a case, need to require 'sidekiq/cli' in that launch code. Ref: https://github.com/mperham/sidekiq/pull/3692#issuecomment-352032251
* | | Suppress `warning: BigDecimal.new is deprecated`Yasuo Honda2017-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `BigDecimal.new` has been deprecated in BigDecimal 1.3.3 which will be a default for Ruby 2.5. Refer https://github.com/ruby/bigdecimal/commit/533737338db915b00dc7168c3602e4b462b23503 * This commit has been made as follows: ``` cd rails git grep -l BigDecimal.new | grep -v guides/source/5_0_release_notes.md | grep -v activesupport/test/xml_mini_test.rb | xargs sed -i -e "s/BigDecimal.new/BigDecimal/g" ``` - `activesupport/test/xml_mini_test.rb` Editmanually to remove `.new` and `::` - guides/source/5_0_release_notes.md This is a Rails 5.0 release notes.
* | | Enable `Layout/LeadingCommentSpace` to not allow cosmetic changes in the futureRyuta Kamizono2017-12-141-1/+1
| |/ |/| | | | | Follow up of #31432.
* | Improve DelayedJob wrapper loggingJacek Lachowski2017-11-241-0/+7
| | | | | | | | | | | | | | | | ActiveJob wraps every adapter into its own class, that is later passed into DelayedJob which is responsible for displaying all the logs. This change improves the logging so we can easily trace executed jobs and see meaningful information in the logs.
* | Make sidekiq and resque integration tests work in CIyuuji.yaginuma2017-11-132-9/+1
| | | | | | | | | | | | | | | | | | | | 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.
* | Return a non zero code when can not connect to redis in CIyuuji.yaginuma2017-11-132-2/+4
| |
* | `rails new` runs `rails active_storage:install`bogdanvlviv2017-11-062-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Omit `rails activestorage:install` for jdbcmysql, jdbc and shebang tests AppGeneratorTest#test_config_jdbcmysql_database rails aborted! LoadError: Could not load 'active_record/connection_adapters/mysql_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (compressed) bin/rails:4:in `<main>' Tasks: TOP => activestorage:install => environment (See full trace by running task with --trace) AppGeneratorTest#test_config_jdbc_database rails aborted! LoadError: Could not load 'active_record/connection_adapters/jdbc_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile. (compressed) bin/rails:4:in `<main>' Tasks: TOP => activestorage:install => environment (See full trace by running task with --trace) AppGeneratorTest#test_shebang_is_added_to_rails_file /home/ubuntu/.rbenv/versions/2.4.1/bin/ruby: no Ruby script found in input (LoadError) Prevent PendingMigrationError in tests * Run `bin/rails db:migrate RAILS_ENV=test` in test_cases before start tests to prevent PendingMigrationError * FileUtils.rm_r("db/migrate") * --skip-active-storage Fix failed tests in `railties/test/railties/engine_test.rb` Related to #30111 Imporve `SharedGeneratorTests#test_default_frameworks_are_required_when_others_are_removed` - Explicitly skip active_storage - Ensure that skipped frameworks are commented - Ensure that default frameworks are not commented Fix error `Errno::ENOSPC: No space left on device - sendfile` Since `rails new` runs `rails active_storage:install` that boots an app. Since adding Bootsnap 0312a5c67e35b960e33677b5358c539f1047e4e1 during booting an app, it creates the cache: 264K tmp/cache/bootsnap-load-path-cache 27M tmp/cache/bootsnap-compile-cache * teardown_app must remove app
* | removed unnecessary returnsShuhei Kitagawa2017-10-281-1/+1
| |
* | Merge pull request #30750 from k2nr/fix-active-jobRyuta Kamizono2017-10-132-2/+2
|\ \ | | | | | | Yield with an error instance instead of error class
| * | Test exception message to ensure an exception instance is yieldedKazunori Kajihiro2017-10-132-2/+2
| |/
* / redis-rb 4.0 supportJeremy Daer2017-10-081-7/+4
|/ | | | | | | | * Use `gem 'redis', '~> 4.0'` for new app Gemfiles * Loosen Action Cable redis-rb dep to `>= 3.3, < 5` * Bump redis-namespace for looser Redis version dep * Avoid using the underlying `redis.client` directly * Use `Redis.new` instead of `Redis.connect`
* Use `ActiveJob::Base.queue_adapter_name` to get adapter nameyuuji.yaginuma2017-08-171-3/+1
| | | | Since 673606a, it holds adapter name.
* Wait for the Delayed Job worker thread to finishMatthew Draper2017-08-131-0/+1
|
* Use File::NULL instead of "/dev/null"Kazuhiro NISHIYAMA2017-07-311-1/+1
|
* Use `ArgumentError` instead of own error classyuuji.yaginuma2017-07-201-17/+17
| | | | | If the argument is invalid, I think that it is more intuitive to use `ArgumentError` than its own error class.
* Add `except` option for ActiveJob::TestHelper methodsposthumanism2017-07-181-0/+359
|
* [Active Job] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-1165-0/+65
|
* Make sidekiq and resque integration tests work in CIyuuji.yaginuma2017-07-102-1/+9
| | | | | | | | | Since f55ecc6, the integration test of sidekiq and resque is not working in CI. https://travis-ci.org/rails/rails/jobs/251783876 Because f55ecc6 required a password to access redis. Therefore, handling by passing passwords when connecting to redis.
* Use frozen-string-literal in ActiveJobKir Shatrov2017-07-0965-0/+65
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0265-65/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-0165-0/+65
|
* ActiveJob::Core#serialize stores provider_job_id (fixes #26581).utilum2017-06-271-0/+8
|
* Use mattr_accessor default: option throughout the projectGenadi Samokovarov2017-06-031-2/+1
|
* Removed string inquiry.Mohit Natoo2017-05-261-2/+2
| | | | | | fixed indentation. rebased with master.
* Provides friendlier way to access queue adapters of a job.Mohit Natoo2017-05-261-1/+6
| | | | - removed predicate method. Used only reader.
* Define path with __dir__bogdanvlviv2017-05-233-3/+3
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* Add missing requireyuuji.yaginuma2017-04-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Without this, unit test fails. ``` bundle exec ruby -w -Ilib:lib:test test/cases/logging_test.rb Using inline Run options: --seed 41246 # Running: SE......S.... Finished in 0.052938s, 245.5696 runs/s, 831.1585 assertions/s. 1) Error: LoggingTest#test_job_error_logging: NameError: uninitialized constant LoggingTest::RescueJob test/cases/logging_test.rb:130:in `rescue in test_job_error_logging' test/cases/logging_test.rb:129:in `test_job_error_logging' 13 runs, 44 assertions, 0 failures, 1 errors, 2 skips You have skipped tests. Run with --verbose for details. ```
* Add error logging to Active JobSteven Bull2017-03-272-1/+8
| | | | | | | | | | | | | | | | | | | | Active Job logging instrumentation is changed to log errors (with backtrace) when a job raises an exception in #perform. This improves debugging during development and test with the default configuration. Prior to Rails 5, the default development configuration ran jobs with InlineAdapter, which would raise exceptions to the caller and be shown in the development log. In Rails 5, the default adapter was changed to AsyncAdapter, which would silently swallow exceptions and log a "Performed SomeJob from Async..." info message. This could be confusing to a developer, as it would seem that the job was performed successfully. This patch removes the "Performed..." info message from the log and adds an error-level "Error performing SomeJob..." log message which includes the exception backtrace for jobs that raise an exception within the #perform method. It provides this behavior for all adapters.
* Revert #27850 following test breakage (#28427)David Heinemeier Hansson2017-03-151-11/+0
|
* Include JobID in all ActiveJob info logsBolek Kurowski2017-02-221-6/+6
| | | | | | | | | | Currently we provide the Job ID in logs only related to enqueuing a job. This adds the job id to the remaining ActiveJob logs when: - a job started performing - a job ended performing Providing the job id in those logs will ease searching logs by job id.
* remove `ActiveSupport.halt_callback_chains_on_return_false` from everywhereyuuji.yaginuma2017-02-081-1/+0
|
* correctly set test adapter when configure the queue adapter on a per job ↵Yuji Yaginuma2017-01-313-0/+21
| | | | | | | | | | | | (#26690) The `ActiveJob::TestHelper` replace the adapter to test adapter in `before_setup`. It gets the target class using the `descendants`, but if the test target job class is not loaded, will not be a replacement of the adapter. Therefore, instead of replacing with `before_setup`, modified to replace when setting adapter. Fixes #26360
* Append skipped jobs to enqueued_jobsAlexander Pauly2017-01-311-0/+11
| | | | | | | | | | Refactored ActiveJob TestAdapter Updated ActiveJob changelog Fixed typo in changelog Fixed formatting issue in changelog
* make backburner integration test to workyuuji.yaginuma2017-01-281-2/+2
| | | | | | | | | | | | | Currently, backburner integration test is not running on CI. https://travis-ci.org/rails/rails/jobs/196005322#L610 Using `Backburner::Worker.connection` to check whether beanstalkd is running. But `Backburner::Worker.connection` was removed in backburner 1.2.0. https://github.com/nesquena/backburner/commit/81fde499c2263abe8dedee59a3d0e03e92d72627 Therefore, this check process always becomes false, so the test is no longer done. I fixed it so that check processing is done correctly.
* assert_enqueued_jobs with queue optionMichael Elfassy2017-01-181-0/+21
|
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-053-3/+3
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* remove useless importSnowmanzzz(Zhengzhong Zhao)2016-12-301-2/+0
|
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-252-3/+3
|
* Privatize unneededly protected methods in Active Job testsAkira Matsuda2016-12-242-2/+2
|
* Output adapter being tested.utilum2016-12-121-0/+1
|
* Avoid race condition in AJ integration testsMatthew Draper2016-11-302-1/+3
| | | | Make sure the file doesn't exist until we've finished writing it.
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-2910-15/+15
|
* removes requires already present in active_support/railsXavier Noria2016-10-271-1/+0
|
* Uses queue adapter_method instead of ActiveJob::Base.queue_adapterGabi Stefanini2016-10-241-2/+2
| | | | Change ActiveJob::Base.queue_adapter to use queue_adapter method to make test code consistent.
* Removed deprecated support to passing the adapter class to .queue_adapterRafael Mendonça França2016-10-101-13/+0
|
* use `descendants` to get class that inherited `ActiveJob::Base`yuuji.yaginuma2016-09-053-0/+16
| | | | | | `subclasses` get only child classes. Therefore, if create a job common parent class as `ApplicationJob`, inherited class does not get properly.
* fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-011-1/+1
|