| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
Refactor arguments logging method for Active Job
|
| |
|
| |
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
match a expected value with message of `assert_equal` in AJ helper methods
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
|
|
|
| |
* Show GlobalID instead of full object .inspect output
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
- Remove un-needed require in AJ rescue test.
|
| |
|
|
|
|
|
|
|
| |
As discussed in #17195, Que uses blank queue names by default for
performance reasons. At the very least, ActiveJob should allow users to
choose "" as their queue name. This commit allows blank queue names, as
well as tests to make sure that nil queue names still use the default.
|
|
|
|
| |
Serialize Global IDs as special objects, distinguishable from Strings
|
|\
| |
| |
| | |
add message to `assert` in `assert_enqueued_with`
|
|/ |
|
|
|
|
|
| |
* Disallow deserialization of non-primitive objects
* Broaden coverage; remove superfluous tests
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
We can split queues on a per environement basis as well as seggregate per application so we can split queues on a per env basis
ActiveJob::Base.queue_name_prefix = 'foo'
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
ActiveJob from app.config.active_job
|
| |
|
| |
|
| |
|