| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
This way JobSerializationTest runs in isolation without errors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When `#perform_later` is called the locale isn't stored on the
queue, which results in a locale reset when the job is performed.
An example of the problem:
I18n.locale = 'de'
HelloJob.perform_now # german message, correct
but
I18n.locale = 'de'
HelloJob.perform_later # english message, incorrect
This PR attaches the current I18n.locale to every job during the
serialization process. It is then restored during deserialization
and used to perform the job with the correct locale.
It falls back to the default locale if no serialized locale is
found in order to provide backward compatibility with previously
stored jobs. It is not necessary to clear the queue for the update.
|
| |
|
| |
|
|\
| |
| | |
Provide provider_job_id to qu adapter.
|
| |
| |
| |
| | |
Further work to provide provider_job_id for queue adapters.
|
|/ |
|
|
|
|
| |
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
When a job is added to Sidekiq by ActiveJob, make sure we still can get the
original job_id provider by Sidekiq. We do this by adding the sidekiq jid to
provider_job_id field on the job object.
Partly fixes #18821
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
|
|
|
|
|
| |
When queueing with DelayedJob, get the id of the job instance and report
it back to ActiveJob as provider_job_id.
|
|
|
|
| |
See #19498
|
|\
| |
| | |
ActiveJob: Stop using Que's named queues.
|
| | |
|
| |
| |
| |
| | |
match a expected value with message of `assert_equal` in AJ helper methods
|
| |
| |
| |
| |
| |
| |
| | |
That seems to be a bug, but as we don't actually care about the
precision for our test, we'll just give it a bit longer.
[Matthew Draper & Cristian Bica]
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
setup gets called from the initializer, so it happens more than once in
a test run. Trying to drop the database again after the first process is
connected is.. ineffective. And entirely pointless.
Instead, defer creating the database to start_workers -- which only
happens once, right before we start doing anything real.
|
| |
| |
| |
| |
| |
| |
| | |
* Don't swallow output -- if there is any, it's probably useful
* Wait for the process to finish
* Use IPC instead of a sleep
* No need for a pidfile
|
| |
| |
| |
| |
| |
| |
| |
| | |
Requiring sidekiq/testing changes stuff, so we need to counteract that
after we do so.
And given its potential to confuse things, let's do it up front, at a
predictable point.
|
| |
| |
| |
| |
| |
| | |
Sidekiq::CLI#boot_system require "#{dummy_app_path}/config/environment.rb".
But this file has already been required in'test/support/integration/helper.rb'.
This patch will change to use Sidekiq::Launcher directly.
|
|/
|
|
|
|
|
| |
Sidekiq logs the name of the job class being performed. Because
ActiveJob wraps the class, this means every job logs as an AJ::JobWrapper
instead of the actual class name.
Will help fix mperham/sidekiq#2248
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I’m renaming all instances of `use_transcational_fixtures` to
`use_transactional_tests` and “transactional fixtures” to
“transactional tests”.
I’m deprecating `use_transactional_fixtures=`. So anyone who is
explicitly setting this will get a warning telling them to use
`use_transactional_tests=` instead.
I’m maintaining backwards compatibility—both forms will work.
`use_transactional_tests` will check to see if
`use_transactional_fixtures` is set and use that, otherwise it will use
itself. But because `use_transactional_tests` is a class attribute
(created with `class_attribute`) this requires a little bit of hoop
jumping. The writer method that `class_attribute` generates defines a
new reader method that return the value being set. Which means we can’t
set the default of `true` using `use_transactional_tests=` as was done
previously because that won’t take into account anyone using
`use_transactional_fixtures`. Instead I defined the reader method
manually and it checks `use_transactional_fixtures`. If it was set then
it should be used, otherwise it should return the default, which is
`true`. If someone uses `use_transactional_tests=` then it will
overwrite the backwards-compatible method with whatever they set.
|
|
|
|
|
|
| |
This allows different `queue_adapters` to be used in each `ActiveJob`
class heirarchy. Previously, all subclasses used a single global queue
adapter.
|
| |
|
| |
|
|
|
|
|
|
|
| |
The filter was set on the pseudo-global TestAdapter but not restored to
its original value.
See e818f65770fe115ab1cc7fbacc0e7e94d92af6a4
|
| |
|
|
|
|
|
|
|
|
|
| |
Since `ActiveJob::TestHelper` globally sets
`ActiveJob::Base.queue_adapter` on setup, there is no benefit in
instantiating a new `TestAdapter` per tests. The original rationale was
to allow parallel tests to run without interference, but since they'd
all mutate the global `ActiveJob::Base.queue_adapter`, that was never
realized.
|
|
|
|
|
|
|
| |
* This allows for easier reading, since those are two words, so they should be
split by _
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
type.
This allows specific jobs to be tested, while preventing others from
being performed unnecessarily.
Example:
def test_hello_job
assert_performed_jobs 1, only: HelloJob do
HelloJob.perform_later('jeremy')
LoggingJob.perform_later
end
end
An array may also be specified, to support testing multiple jobs.
Example:
def test_hello_and_logging_jobs
assert_nothing_raised do
assert_performed_jobs 2, only: [HelloJob, LoggingJob] do
HelloJob.perform_later('jeremy')
LoggingJob.perform_later('stewie')
RescueJob.perform_later('david')
end
end
end
Fixes #18802.
Trim space and document :only option.
|
|
|
|
| |
ref: https://github.com/rails/rails/pull/18763#issuecomment-72349769
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unfortunately, the HashWithIndifferent access approach is insufficient
for our needs. It's perfectly reasonable to want to use keyword
arguments with Active Job, which we will see as a symbol keyed hash. For
Ruby to convert this back to keyword arguments, it must deserialize to a
symbol keyed hash.
There are two primary changes to the serialization behavior. We first
treat a HWIA separately, and mark it as such so we can convert it back
into a HWIA during deserialization.
For normal hashes, we keep a list of all symbol keys, and convert them
back to symbol keys after deserialization.
Fixes #18741.
|
| |
|
| |
|
|
|
|
| |
With the option, assert_enqueued_jobs will check the number of times a specific kind of job is enqueued.
|
| |
|
|
|
|
|
|
|
|
| |
1. The :test adapter wasn't going through a full cycle of
serialize/deserialize when performing jobs. Now it does
2. Regular AJ tests were not run for the :test adapter. Now they are
3. ActiveJob::TestHelper uses assert_valid_keys but doesn’t requires
the file that implements that method. Now it does
|
| |
|
|
|
|
| |
Use redis protocol
|
| |
|
|\
| |
| | |
GlobalID objects are logged by their URI, not #inspect on the object, to prevent logging private data
|
| | |
|
| |
| |
| |
| | |
* Show GlobalID instead of full object .inspect output
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Fix Sidekiq ActiveJob integration setup
Conflicts:
activejob/test/support/integration/adapters/sidekiq.rb
|
| |/
| |
| |
| |
| |
| | |
* .connect on a Redis connection wasn't valid
* Reset logger after we're done testing for redis connection to avoid
"closed stream" error when starting server for real from a fork
|
|/ |
|
|
|
|
|
|
|
|
|
| |
It will set proper queue_adapter state required by assert_performed_jobs assertions.
Also the block version of assert_performed_jobs will make sure this
state is respected.
Fixes #17684
|
|
|
|
|
|
|
|
| |
- Added ActiveJob::Base#queue_name_delimiter to allow for
developers using ActiveJob to change the delimiter from the default
('_') to whatever else they may be using (e.g., '.', '-', ...).
- Updated source guide to include a blurb about the delimiter.
|
|\
| |
| | |
Inline AJ around_perform and around_enqueue in CallbackJob used for tests
|
| | |
|