sidekiq-failures 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/sidekiq/failures/sorted_entry.rb +9 -0
- data/lib/sidekiq/failures/version.rb +1 -1
- data/test/web_extension_test.rb +35 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71027ff19b10b529acabafaba413fb8e6c79cd94
|
4
|
+
data.tar.gz: b8d994984de5da5050c78962704169f30f6c4e60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5eb5e39114e6a384d8285dd6e9e4d32d62d6dc8adbfaa76c55af1f7bce617bb93fc5242cba0c24c87168ec7d7fa450880d602e7f06b341d09f378aefb73957f6
|
7
|
+
data.tar.gz: d5e89bad2b074dedc2d64976becae9d30651aae28c55799572c3870db87de42c4f8e8b1903f4d50f9fdb0b8c97b6959cc5ae88e95db41615ac981e77e8981d56
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
module Sidekiq
|
2
2
|
class SortedEntry
|
3
|
+
alias_method :super_initialize, :initialize
|
4
|
+
|
5
|
+
def initialize(parent, score, item)
|
6
|
+
super_initialize(parent, score, item)
|
7
|
+
|
8
|
+
# 0.3.0 compatibility
|
9
|
+
@item.merge!(@item["payload"]) if @item["payload"]
|
10
|
+
end
|
11
|
+
|
3
12
|
def retry_failure
|
4
13
|
Sidekiq.redis do |conn|
|
5
14
|
results = conn.zrangebyscore(Sidekiq::Failures::LIST_KEY, score, score)
|
data/test/web_extension_test.rb
CHANGED
@@ -135,6 +135,39 @@ module Sidekiq
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
describe 'when there are failures with deprecated format' do
|
139
|
+
before do
|
140
|
+
create_sample_failure(args: nil, payload: { args: ['bob', 5] })
|
141
|
+
get '/failures'
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'should be successful' do
|
145
|
+
last_response.status.must_equal 200
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'can display failures page with failures listed' do
|
149
|
+
last_response.body.must_match /Failed Jobs/
|
150
|
+
last_response.body.must_match /HardWorker/
|
151
|
+
last_response.body.must_match /ArgumentError/
|
152
|
+
last_response.body.wont_match /No failed jobs found/
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
describe 'when there are failures with unescaped data' do
|
157
|
+
before do
|
158
|
+
create_sample_failure(args: ['<h1>omg</h1>'], error_message: '<p>wow</p>')
|
159
|
+
get '/failures'
|
160
|
+
end
|
161
|
+
|
162
|
+
it 'can escape arguments' do
|
163
|
+
last_response.body.must_match /"<h1>omg</h1>"/
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'can escape error message' do
|
167
|
+
last_response.body.must_match /ArgumentError: <p>wow</p>/
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
138
171
|
describe 'when there is failure' do
|
139
172
|
before do
|
140
173
|
create_sample_failure
|
@@ -177,7 +210,7 @@ module Sidekiq
|
|
177
210
|
end
|
178
211
|
end
|
179
212
|
|
180
|
-
def create_sample_failure
|
213
|
+
def create_sample_failure(data = {})
|
181
214
|
data = {
|
182
215
|
:queue => 'default',
|
183
216
|
:class => 'HardWorker',
|
@@ -188,7 +221,7 @@ module Sidekiq
|
|
188
221
|
:error_class => 'ArgumentError',
|
189
222
|
:error_message => 'Some new message',
|
190
223
|
:error_backtrace => ["path/file1.rb", "path/file2.rb"]
|
191
|
-
}
|
224
|
+
}.merge(data)
|
192
225
|
|
193
226
|
Sidekiq.redis do |c|
|
194
227
|
c.multi do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-failures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Silveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|