aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/support
Commit message (Collapse)AuthorAgeFilesLines
* Use `try` only when we're unsure if the receiver would respond_to the methodAkira Matsuda2019-08-011-1/+1
|
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Respect ENV variables when finding DBs etc for the test suiteMatthew Draper2019-02-063-2/+3
| | | | | 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.
* Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-211-6/+4
| | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* Permit ActionController::Parameters for serializable HashBernie Chiu2018-11-191-0/+15
|
* Remove an extra `@mutex.synchronize`yuuji.yaginuma2018-10-191-12/+1
| | | | | | | | Since `@mutex.synchronize` is enforced in the `ensure_connection!` method, there is no need to do so on the caller side. https://github.com/jondot/sneakers/blob/c1b47f9c5d5a95da728bbe1700795790e4efbb12/lib/sneakers/publisher.rb#L22-L26 Due to this, `ThreadError(deadlock; recursive locking)` has occurred.
* Return a non zero code when can not connect to backend on CIyuuji.yaginuma2018-10-194-4/+8
|
* Ignore psqlrc files when executing psql commandsJ Smith2018-09-172-4/+4
| | | | | | psqlrc files can affect the execution of commands in ways that can hold up execution by blocking or otherwise cause unexpected side effects and should best be ignored when using psql programmatically.
* Print correct rake command on running AJ integration testsbogdanvlviv2018-09-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Currently when executing `bundle exec rake test:integration` under `activejob/` derectory, it prints helpful info like: ``` (snip) *** rake aj:integration:async *** (snip) *** rake aj:integration:delayed_job *** (snip) ``` but there is no defined `:aj` scope in `activejob/Rakefile`, so I think output should be like: ``` (snip) *** rake test:integration:async *** (snip) *** rake test:integration:delayed_job *** (snip) ``` By the way `rake test:integration` doesn't work if execute it without prepending `bundle exec` to that command. It is probably what we should fix too.
* Fix Ruby warnings tickled by the test suiteutilum2018-06-302-4/+6
|
* Remove support for Qu gem.Alberto Almagro2018-03-191-40/+0
| | | | | | Reasons are that the Qu gem wasn't compatible since Rails 5.1, gem development was stopped in 2014 and maintainers have confirmed its demise. See issue #32273
* Add support for timezones to Active JobAndrew White2018-02-222-0/+5
| | | | | | Record what was the current timezone in effect when the job was enqueued and then restore when the job is executed in same way that the current locale is recorded and restored.
* 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
* Enable `Layout/LeadingCommentSpace` to not allow cosmetic changes in the futureRyuta Kamizono2017-12-141-1/+1
| | | | Follow up of #31432.
* 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
|
* 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
|
* [Active Job] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-1121-0/+21
|
* 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-0921-0/+21
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0221-21/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-0121-0/+21
|
* Use mattr_accessor default: option throughout the projectGenadi Samokovarov2017-06-031-2/+1
|
* Define path with __dir__bogdanvlviv2017-05-232-2/+2
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* 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.
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-1/+1
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Privatize unneededly protected methods in Active Job testsAkira Matsuda2016-12-242-2/+2
|
* 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-296-11/+11
|
* removes requires already present in active_support/railsXavier Noria2016-10-271-1/+0
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-7/+7
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* code gardening: removes redundant selfsXavier Noria2016-08-081-1/+1
| | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-062-2/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-063-3/+1
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-3/+2
|
* modernizes hash syntax in activejobXavier Noria2016-08-062-11/+11
|
* applies new string literal convention in activejob/testXavier Noria2016-08-0616-50/+50
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Chomp: prefer String#chomp where we can for a clarity boostlvl0nax2016-04-291-1/+3
| | | | | | Closes #24766, #24767 Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Merge pull request #23966 from ↵Jeremy Daer2016-03-011-1/+2
|\ | | | | | | | | jeremy/activejob/pare-down-async-adapter-for-low-footprint-dev Active Job: pare down async adapter for low footprint dev
| * Active Job: smaller footprint for the dev/test async adapterJeremy Daer2016-02-291-1/+2
| | | | | | | | | | Use one shared worker pool for all queues with 0-#CPU workers rather than separate pools per queue with 2-10*#CPU workers each.
* | - Updating the dummy app template to have rails_command instead of rakeMohit Natoo2016-03-011-1/+1
|/
* Remove celluloid from the GemfileRafael Mendonça França2016-01-271-3/+1
|
* Fix race condition testing for job execution orderWill Jessop2015-11-232-6/+17
| | | | | | | | | | | | | | | On most filesystems file ctime is limited to 1 second granularity, which means that on faster computers multiple simple jobs (for instance dummy TestJob) can finish within the same second. The execution order test in ActiveJob integration tests relies on multiple TestJobs writing files then comparing the ctime. As a result integration tests would sometimes fail as the ctime of the files written by these TestJobs could have coincidental ctimes making the comparison for job order fail. This commit adds a far more precise execution time (to the extent that the Ruby Time class allows) to the file created by TestJob, and updates the execution order assertion to use it, removing the race condition.
* Merge pull request #19425 from wvengen/feature/activejob-priority-masterRafael Mendonça França2015-09-252-2/+7
|\ | | | | Add job priorities to ActiveJob