1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
Commit graph

17 commits

Author SHA1 Message Date
Mike Perham
cc59d07e48 Disable delay extensions by default, fixes #3174 (#3299)
* Disable delay extensions by default, fixes #3174

* Size check for YAML payload

* so racy

* Allow larger, explicit size in message

* Polish
2017-01-04 10:30:42 -08:00
Fernando Seror Garcia
7a63036b21 Add the enqueued_at attribute when fake Testing (#3258)
Trying to emulate the real behavior, the job obtains an enqueued_at
attribute when it's placed in a queue.

Since using perform_in or perform_at does not put the job in the queue
when run, the attribute is not set for those methods.
2016-11-25 21:19:16 -08:00
Mike Perham
72fe3289ea Merge branch 'master' into frozen 2016-04-21 13:15:00 -07:00
Martin Sereinig
ede0cdb56b Fixed drain_all for workers with symbolized queue names in tests
The queue-based testing hash (@jobs_by_queue) stores the queue name as a string. Therefore, when a worker is given a symbol as queue name, deleting the job from the @jobs_by_queue silently fails, leaving the job in @jobs_by_queue (even though deleting succeded from the @jobs_by_worker). Sidekiq::Worker.drain_all gets the jobs through @jobs_by_queue, but since the josb are not removed after execution, calling drain_all will result in an endless loop.
2016-01-14 15:25:03 +01:00
Mike Perham
2c9f7662fc Freeze all string literals in source, fixes #2741
Tests pass and smoke test works perfectly.
2015-12-31 15:33:35 -08:00
Anthony Scalisi
2f3ac379dd fix typos 2015-12-08 12:39:32 -08:00
Brandon Hilkert
c4330cb326 Add test to attempt to recreate Rspec syntax 2015-11-25 09:52:22 -05:00
Brandon Hilkert
6b277de4d5 Revert "Revert "Merge pull request #2659 from mperham/queue-testing-api""
This reverts commit 56ebcfd161.
2015-11-17 13:07:30 -05:00
Brandon Hilkert
56ebcfd161 Revert "Merge pull request #2659 from mperham/queue-testing-api"
This reverts commit df739ca968, reversing
changes made to dbd8bed17c.
2015-11-17 12:44:56 -05:00
Brandon Hilkert
df755bbeef Unique all workers and ensure symbol queues are stringified via testing
API
2015-11-13 17:08:54 -05:00
Brandon Hilkert
ec006873ac Can't use constantize if the worker doesn't exist 2015-11-13 16:20:15 -05:00
Brandon Hilkert
321234e81d Implements queue-based testing API
When using the Sidekiq::Client API to push jobs on to the queue, it's
not ideal to assert the size of the queue from the perspective of a
worker because the worker may not exist in the application.

This API implements a testing API from the perspective of a queue. The
existing Worker-based testing API remains unchanged, but leverages the
job hash implemented through the Sidekiq::Queues class.

Examples:

    assert_equal 1, Sidekiq::Queues["default"].size
    assert_equal "SpecialWorker", Sidekiq::Queues["default"].first["class"]
    Sidekiq::Queues["default"].clear
    Sidekiq::Queues.clear_all
2015-11-13 15:25:10 -05:00
Mike Perham
53e6b9e2df Test suite overhaul
Remove Redis mocking.  Minimize Redis flushing where possible.
2015-09-23 10:56:37 -07:00
Ryan Schlesinger
a71e1bbe18 Add middleware stack to Testing 2015-09-04 15:35:33 -07:00
grosser
57a06d00d6 allow every test to be run with just ruby test/xxx_test.rb 2014-12-30 12:54:58 -08:00
jejacks0n
7714d19619 extracts worker.perform so call can be enhanced
- defines execute_job as an API hook
2014-09-10 11:13:24 -06:00
Ryan Schlesinger
fd0232eb15 Add dynamic testing
In addition to requiring 'sidekiq/testing' and 'sidekiq/testing/inline',
a user can also call the following methods to control the test harness:

Sidekiq::Testing.fake!
Sidekiq::Testing.inline!
Sidekiq::Testing.disable!

Each of the above methods also accepts a block to execute within that
context before reverting to the state present before method invocation.

To query the current state, use the following methods:

Sidekiq::Testing.enabled?
Sidekiq::Testing.disabled?
Sidekiq::Testing.fake?
Sidekiq::Testing.inline?

Closes #1053
2013-09-23 12:07:23 -07:00