sidekiq-failures 0.4.2 → 0.4.3
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/.gitignore +3 -0
- data/.travis.yml +4 -3
- data/CHANGELOG.md +3 -0
- data/lib/sidekiq/failures/version.rb +1 -1
- data/lib/sidekiq/failures/views/failures.erb +1 -1
- data/lib/sidekiq/failures/web_extension.rb +12 -0
- data/test/web_extension_test.rb +41 -44
- 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: dbf773e3881e5c3f66679dc77ce221997c58442d
|
4
|
+
data.tar.gz: 8fde6abd64a06cd529e7bf523a8f018c68cd9900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61dc54a740b82bd9317bec3240468dcd9fdb30663cc2eea05c2368fb117c307e5eeb2979388309177fd7c5a1bec692997e041675d6bba5d11265e95d8492a069
|
7
|
+
data.tar.gz: 58fca490bba04d832220c1ee1689cb19adfb6a0b457d76fbd79f82b1171ace187990cd47147f3ac8c081bcf36453bb1aa0d858b923bdb2f91058048b27984050
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -8,9 +8,10 @@ rvm:
|
|
8
8
|
- 2.1
|
9
9
|
env:
|
10
10
|
matrix:
|
11
|
-
- SIDEKIQ_VERSION="~> 2.16
|
12
|
-
- SIDEKIQ_VERSION="~> 2.17
|
13
|
-
- SIDEKIQ_VERSION="~> 3.0
|
11
|
+
- SIDEKIQ_VERSION="~> 2.16"
|
12
|
+
- SIDEKIQ_VERSION="~> 2.17"
|
13
|
+
- SIDEKIQ_VERSION="~> 3.0"
|
14
|
+
- SIDEKIQ_VERSION="~> 3.1"
|
14
15
|
matrix:
|
15
16
|
allow_failures:
|
16
17
|
- rvm: 1.9.3
|
data/CHANGELOG.md
CHANGED
@@ -41,7 +41,7 @@
|
|
41
41
|
<td>
|
42
42
|
<a href="<%= root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
|
43
43
|
</td>
|
44
|
-
<td><%=
|
44
|
+
<td><%= safe_relative_time(entry['failed_at']) %></td>
|
45
45
|
<td style="overflow: auto; padding: 10px;">
|
46
46
|
<a class="backtrace" href="#" onclick="$(this).next().toggle(); return false">
|
47
47
|
<%= h entry['error_class'] %>: <%= h entry['error_message'] %>
|
@@ -5,6 +5,18 @@ module Sidekiq
|
|
5
5
|
def self.registered(app)
|
6
6
|
view_path = File.join(File.expand_path("..", __FILE__), "views")
|
7
7
|
|
8
|
+
app.helpers do
|
9
|
+
def safe_relative_time(time)
|
10
|
+
time = if time.is_a?(Numeric)
|
11
|
+
Time.at(time)
|
12
|
+
else
|
13
|
+
Time.parse(time)
|
14
|
+
end
|
15
|
+
|
16
|
+
relative_time(time)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
8
20
|
app.get "/failures" do
|
9
21
|
@count = (params[:count] || 25).to_i
|
10
22
|
(@current_page, @total_size, @failures) = page(LIST_KEY, params[:page], @count)
|
data/test/web_extension_test.rb
CHANGED
@@ -135,50 +135,6 @@ 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
|
-
|
171
|
-
describe 'when there are failures with old timestamp format' do
|
172
|
-
before do
|
173
|
-
create_sample_failure failed_at: Time.now.strftime('%Y-%m-%dT%H:%M:%SZ')
|
174
|
-
get '/failures'
|
175
|
-
end
|
176
|
-
|
177
|
-
it 'should be successful' do
|
178
|
-
last_response.status.must_equal 200
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
138
|
describe 'when there is failure' do
|
183
139
|
before do
|
184
140
|
create_sample_failure
|
@@ -221,6 +177,47 @@ module Sidekiq
|
|
221
177
|
end
|
222
178
|
end
|
223
179
|
|
180
|
+
describe 'when there is specific failure' do
|
181
|
+
describe 'with unescaped data' do
|
182
|
+
before do
|
183
|
+
create_sample_failure(args: ['<h1>omg</h1>'], error_message: '<p>wow</p>')
|
184
|
+
get '/failures'
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'can escape arguments' do
|
188
|
+
last_response.body.must_match /"<h1>omg</h1>"/
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'can escape error message' do
|
192
|
+
last_response.body.must_match /ArgumentError: <p>wow</p>/
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
describe 'with deprecated payload' do
|
197
|
+
before do
|
198
|
+
create_sample_failure(args: nil, payload: { args: ['bob', 5] })
|
199
|
+
get '/failures'
|
200
|
+
end
|
201
|
+
|
202
|
+
it 'should be successful' do
|
203
|
+
last_response.status.must_equal 200
|
204
|
+
last_response.body.wont_match /No failed jobs found/
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
describe 'with deprecated timestamp' do
|
209
|
+
before do
|
210
|
+
create_sample_failure(failed_at: Time.now.strftime('%Y-%m-%dT%H:%M:%SZ'))
|
211
|
+
get '/failures'
|
212
|
+
end
|
213
|
+
|
214
|
+
it 'should be successful' do
|
215
|
+
last_response.status.must_equal 200
|
216
|
+
last_response.body.wont_match /No failed jobs found/
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
224
221
|
def create_sample_failure(data = {})
|
225
222
|
data = {
|
226
223
|
:queue => 'default',
|
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.3
|
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-06-
|
11
|
+
date: 2014-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|