sidekiq-failures 1.0.0 → 1.0.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 +5 -5
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/ci.yml +37 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +6 -0
- data/README.md +3 -1
- data/lib/sidekiq/failures/locales/zh-cn.yml +5 -0
- data/lib/sidekiq/failures/middleware.rb +1 -1
- data/lib/sidekiq/failures/version.rb +1 -1
- data/lib/sidekiq/failures/views/failures.erb +27 -7
- data/lib/sidekiq/failures/web_extension.rb +1 -1
- data/sidekiq-failures.gemspec +8 -2
- data/test/middleware_test.rb +58 -64
- data/test/test_helper.rb +1 -0
- data/test/web_extension_test.rb +73 -65
- metadata +12 -14
- data/.travis.yml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0d9628945c34d8f9ed07942963bfa2af8205d62813380126efc72fdb2f357dac
|
4
|
+
data.tar.gz: 9909e3f78cf4974de23878094751200f7d23b795637524d469b40d26237cf8c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df5f041943257ee40566a7eb740abd0f61c69d8a03e15f0b8a4727bc1a37a72115a6173684f22a11a095c7478c7f4c325e7e73fce1094fe72a147213443384c5
|
7
|
+
data.tar.gz: b7265f98b1ba526c14d3c2a28a5d17a85dc8fa9231d7233623c964784cb903557518729398db13e07605a6d2367cc143b6084900fb68faff029c6339c0fbe923
|
@@ -0,0 +1,37 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
ruby: [2.6, 2.7, '3.0', 3.1]
|
16
|
+
sidekiq: [4.2, 5.2, 6.2]
|
17
|
+
services:
|
18
|
+
redis:
|
19
|
+
image: redis
|
20
|
+
options: >-
|
21
|
+
--health-cmd "redis-cli ping"
|
22
|
+
--health-interval 10s
|
23
|
+
--health-timeout 5s
|
24
|
+
--health-retries 5
|
25
|
+
ports:
|
26
|
+
- 6379:6379
|
27
|
+
env:
|
28
|
+
SIDEKIQ_VERSION: ~> ${{ matrix.sidekiq }}
|
29
|
+
steps:
|
30
|
+
- uses: actions/checkout@v3
|
31
|
+
- name: Set up Ruby
|
32
|
+
uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
bundler-cache: true # 'bundle install' and cache gems
|
35
|
+
ruby-version: ${{ matrix.ruby }}
|
36
|
+
- name: Run tests
|
37
|
+
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
+
## 1.0.3
|
4
|
+
|
5
|
+
* Expand failure descriptions with pure JS (#141 @icyleaf)
|
6
|
+
|
7
|
+
## 1.0.2
|
8
|
+
|
9
|
+
* Pass now required argument to Sidekiq's JobRetry.new (#140 @mcasper)
|
10
|
+
|
11
|
+
## 1.0.1
|
12
|
+
|
13
|
+
* Add license config to the gemspec (#115 @reiz)
|
14
|
+
* Guard against failure error_message being `nil` (#122 @mcasper)
|
15
|
+
* Fix filtering failures with 0 results on Sidekiq Pro (#125 @substars)
|
16
|
+
|
3
17
|
## 1.0.0
|
4
18
|
|
5
19
|
* WebUI improvements (@bbtfr)
|
data/Gemfile
CHANGED
@@ -4,3 +4,9 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
gem 'sidekiq', ENV['SIDEKIQ_VERSION'] if ENV['SIDEKIQ_VERSION']
|
7
|
+
|
8
|
+
# to test Pro-specific functionality, set SIDEKIQ_PRO_CREDS on `bundle install`
|
9
|
+
# and SIDEKIQ_PRO_VERSION on `bundle install` and `rake test`
|
10
|
+
source "https://#{ENV['SIDEKIQ_PRO_CREDS']}@enterprise.contribsys.com/" do
|
11
|
+
gem 'sidekiq-pro', ENV['SIDEKIQ_PRO_VERSION'] if ENV['SIDEKIQ_PRO_VERSION']
|
12
|
+
end if ENV['SIDEKIQ_PRO_VERSION']
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Sidekiq::Failures
|
1
|
+
# Sidekiq::Failures 
|
2
2
|
|
3
3
|
Keeps track of Sidekiq failed jobs and adds a tab to the Web UI to let you browse
|
4
4
|
them. Makes use of Sidekiq's custom tabs and middleware chain.
|
@@ -20,6 +20,8 @@ gem 'sidekiq-failures'
|
|
20
20
|
Simply having the gem in your Gemfile is enough to get you started. Your failed
|
21
21
|
jobs will be visible via a Failures tab in the Web UI.
|
22
22
|
|
23
|
+
If you have not previously used the Web UI, it is a part of the Sidekiq gem. [See Sidekiq's docs about Web UI here.](https://github.com/mperham/sidekiq/wiki/Monitoring#web-ui)
|
24
|
+
|
23
25
|
## Configuring
|
24
26
|
|
25
27
|
### Maximum Tracked Failures
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<div class="col-sm-5">
|
3
3
|
<h3><%= t('FailedJobs') %></h3>
|
4
4
|
</div>
|
5
|
-
<% if @failures.
|
5
|
+
<% if @failures.count > 0 && @total_size > @count %>
|
6
6
|
<div class="col-sm-4">
|
7
7
|
<%= erb :_paging, :locals => { :url => "#{root_path}failures" } %>
|
8
8
|
</div>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<%= filtering('failures') if respond_to?(:filtering) %>
|
11
11
|
</header>
|
12
12
|
|
13
|
-
<% if @failures.
|
13
|
+
<% if @failures.count > 0 %>
|
14
14
|
<form action="<%= root_path %>failures" method="post">
|
15
15
|
<%= csrf_tag if respond_to?(:csrf_tag) %>
|
16
16
|
<table class="table table-striped table-bordered table-white">
|
@@ -35,7 +35,9 @@
|
|
35
35
|
<input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' />
|
36
36
|
</label>
|
37
37
|
</td>
|
38
|
-
<td
|
38
|
+
<td>
|
39
|
+
<a href="<%= root_path %>failures/<%= job_params(entry.item, entry.score) %>"><%= safe_relative_time(entry['failed_at']) %></a>
|
40
|
+
</td>
|
39
41
|
<td>
|
40
42
|
<a href="<%= root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
|
41
43
|
</td>
|
@@ -44,8 +46,8 @@
|
|
44
46
|
<div class="args"><%= display_args(entry.respond_to?(:display_args) ? entry.display_args : entry.args) %></div>
|
45
47
|
</td>
|
46
48
|
<td style="overflow: auto; padding: 10px;">
|
47
|
-
<a class="backtrace" href="
|
48
|
-
<%= h entry['error_class'] %>: <%= h entry['error_message'].size > 500 ? entry['error_message'][0..500] + '...' : entry['error_message'] %>
|
49
|
+
<a class="backtrace" href="javascript:void(0)", onclick="toggle_error_backtrace(this)">
|
50
|
+
<%= h entry['error_class'] %>: <%= h entry['error_message'].to_s.size > 500 ? entry['error_message'][0..500] + '...' : entry['error_message'] %>
|
49
51
|
</a>
|
50
52
|
<pre style="display: none; background: none; border: 0; width: 100%; max-height: 30em; font-size: 0.8em; white-space: nowrap; overflow: auto;">
|
51
53
|
<%= entry['error_backtrace'].join("<br />") if entry['error_backtrace'] %>
|
@@ -70,16 +72,34 @@
|
|
70
72
|
<input class="btn btn-danger btn-xs pull-right" type="submit" name="retry" value="<%= t('RetryAll') %>" data-confirm="<%= t('AreYouSure') %>" />
|
71
73
|
</form>
|
72
74
|
|
73
|
-
<% if @failures.
|
75
|
+
<% if @failures.count > 0 && @total_size > @count %>
|
74
76
|
<div class="col-sm-4">
|
75
77
|
<%= erb :_paging, :locals => { :url => "#{root_path}failures" } %>
|
76
78
|
</div>
|
77
79
|
<% end %>
|
78
80
|
|
81
|
+
<script>
|
82
|
+
function toggle_error_backtrace(e) {
|
83
|
+
let x = e.nextElementSibling;
|
84
|
+
if (x.style.display === "none") {
|
85
|
+
x.style.display = "block";
|
86
|
+
} else {
|
87
|
+
x.style.display = "none";
|
88
|
+
}
|
89
|
+
}
|
90
|
+
</script>
|
91
|
+
|
92
|
+
<style type="text/css">
|
93
|
+
@media only screen and (prefers-color-scheme: dark) {
|
94
|
+
pre {
|
95
|
+
color: white
|
96
|
+
}
|
97
|
+
}
|
98
|
+
</style>
|
79
99
|
<% else %>
|
80
100
|
<div class="alert alert-success"><%= t('NoFailedJobsFound') %></div>
|
81
101
|
<% end %>
|
82
102
|
<form action="<%= root_path %>failures/all/reset" method="post">
|
83
103
|
<%= csrf_tag if respond_to?(:csrf_tag) %>
|
84
|
-
<input class="btn btn-danger btn-xs pull-right" type="submit" name="reset" value="<%= t('
|
104
|
+
<input class="btn btn-danger btn-xs pull-right" type="submit" name="reset" value="<%= t('ResetCounter') %>" data-confirm="<%= t('AreYouSure') %>" />
|
85
105
|
</form>
|
@@ -86,7 +86,7 @@ module Sidekiq
|
|
86
86
|
app.post '/filter/failures' do
|
87
87
|
@failures = Sidekiq::Failures::FailureSet.new.scan("*#{params[:substr]}*")
|
88
88
|
@current_page = 1
|
89
|
-
@count = @total_size = @failures.
|
89
|
+
@count = @total_size = @failures.count
|
90
90
|
render(:erb, File.read(File.join(view_path, "failures.erb")))
|
91
91
|
end
|
92
92
|
end
|
data/sidekiq-failures.gemspec
CHANGED
@@ -7,16 +7,22 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.description = %q{Keep track of Sidekiq failed jobs}
|
8
8
|
gem.summary = %q{Keeps track of Sidekiq failed jobs and adds a tab to the Web UI to let you browse them. Makes use of Sidekiq's custom tabs and middleware chain.}
|
9
9
|
gem.homepage = "https://github.com/mhfs/sidekiq-failures/"
|
10
|
+
gem.license = "MIT"
|
10
11
|
|
11
12
|
gem.files = `git ls-files`.split($\)
|
12
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
13
|
gem.name = "sidekiq-failures"
|
15
14
|
gem.require_paths = ["lib"]
|
16
15
|
gem.version = Sidekiq::Failures::VERSION
|
17
16
|
|
18
17
|
gem.add_dependency "sidekiq", ">= 4.0.0"
|
19
18
|
|
19
|
+
# Redis 4.X is incompatible with Ruby < 2.3, but the Ruby version constraint
|
20
|
+
# wasn't added until 4.1.2, meaning you can get an incompatible version of the
|
21
|
+
# redis gem when running Ruby 2.2 without this constraint.
|
22
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.3.0")
|
23
|
+
gem.add_dependency "redis", "< 4.0"
|
24
|
+
end
|
25
|
+
|
20
26
|
gem.add_development_dependency "minitest"
|
21
27
|
gem.add_development_dependency "rake"
|
22
28
|
gem.add_development_dependency "rack-test"
|
data/test/middleware_test.rb
CHANGED
@@ -1,19 +1,72 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
|
+
class SidekiqPre6
|
4
|
+
def new_processor(boss)
|
5
|
+
num_options_calls.times { boss.expect(:options, {:queues => ['default'] }, []) }
|
6
|
+
::Sidekiq::Processor.new(boss)
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def num_options_calls
|
12
|
+
if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('5.0.3')
|
13
|
+
3
|
14
|
+
else
|
15
|
+
2
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class SidekiqPre63
|
21
|
+
def new_processor(boss)
|
22
|
+
opts = {
|
23
|
+
queues: ['default'],
|
24
|
+
}
|
25
|
+
opts[:fetch] = Sidekiq::BasicFetch.new(opts)
|
26
|
+
::Sidekiq::Processor.new(boss, opts)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class SidekiqPost63
|
31
|
+
def new_processor(boss)
|
32
|
+
config = Sidekiq
|
33
|
+
config[:queues] = ['default']
|
34
|
+
config[:fetch] = Sidekiq::BasicFetch.new(config)
|
35
|
+
config[:error_handlers] << Sidekiq.method(:default_error_handler)
|
36
|
+
::Sidekiq::Processor.new(config) { |processor, reason = nil| }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
3
40
|
module Sidekiq
|
4
41
|
module Failures
|
5
42
|
describe "Middleware" do
|
43
|
+
def new_provider
|
44
|
+
version = Gem::Version.new(Sidekiq::VERSION)
|
45
|
+
if version >= Gem::Version.new('6.4.0')
|
46
|
+
SidekiqPost63
|
47
|
+
elsif version >= Gem::Version.new('6.0')
|
48
|
+
SidekiqPre63
|
49
|
+
else
|
50
|
+
SidekiqPre6
|
51
|
+
end.new
|
52
|
+
end
|
53
|
+
|
6
54
|
before do
|
7
55
|
$invokes = 0
|
8
56
|
@boss = MiniTest::Mock.new
|
9
|
-
|
10
|
-
@processor =
|
57
|
+
@provider = new_provider
|
58
|
+
@processor = @provider.new_processor(@boss)
|
59
|
+
|
11
60
|
Sidekiq.server_middleware {|chain| chain.add Sidekiq::Failures::Middleware }
|
12
61
|
Sidekiq.redis = REDIS
|
13
62
|
Sidekiq.redis { |c| c.flushdb }
|
14
63
|
Sidekiq.instance_eval { @failures_default_mode = nil }
|
15
64
|
end
|
16
65
|
|
66
|
+
after do
|
67
|
+
@boss.verify
|
68
|
+
end
|
69
|
+
|
17
70
|
TestException = Class.new(Exception)
|
18
71
|
ShutdownException = Class.new(Sidekiq::Shutdown)
|
19
72
|
|
@@ -42,11 +95,6 @@ module Sidekiq
|
|
42
95
|
|
43
96
|
assert_equal 0, failures_count
|
44
97
|
|
45
|
-
actor = MiniTest::Mock.new
|
46
|
-
actor.expect(:processor_done, nil, [@processor])
|
47
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
48
|
-
2.times { @boss.expect(:async, actor, []) }
|
49
|
-
|
50
98
|
assert_raises TestException do
|
51
99
|
@processor.process(msg)
|
52
100
|
end
|
@@ -60,11 +108,6 @@ module Sidekiq
|
|
60
108
|
|
61
109
|
assert_equal 0, failures_count
|
62
110
|
|
63
|
-
actor = MiniTest::Mock.new
|
64
|
-
actor.expect(:processor_done, nil, [@processor])
|
65
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
66
|
-
2.times { @boss.expect(:async, actor, []) }
|
67
|
-
|
68
111
|
assert_raises TestException do
|
69
112
|
@processor.process(msg)
|
70
113
|
end
|
@@ -78,12 +121,7 @@ module Sidekiq
|
|
78
121
|
|
79
122
|
assert_equal 0, failures_count
|
80
123
|
|
81
|
-
actor = MiniTest::Mock.new
|
82
|
-
actor.expect(:processor_done, nil, [@processor])
|
83
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
84
|
-
|
85
124
|
@processor.process(msg)
|
86
|
-
@boss.verify
|
87
125
|
|
88
126
|
assert_equal 0, failures_count
|
89
127
|
assert_equal 1, $invokes
|
@@ -94,11 +132,6 @@ module Sidekiq
|
|
94
132
|
|
95
133
|
assert_equal 0, failures_count
|
96
134
|
|
97
|
-
actor = MiniTest::Mock.new
|
98
|
-
actor.expect(:processor_done, nil, [@processor])
|
99
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
100
|
-
2.times { @boss.expect(:async, actor, []) }
|
101
|
-
|
102
135
|
assert_raises TestException do
|
103
136
|
@processor.process(msg)
|
104
137
|
end
|
@@ -114,11 +147,6 @@ module Sidekiq
|
|
114
147
|
|
115
148
|
assert_equal 0, failures_count
|
116
149
|
|
117
|
-
actor = MiniTest::Mock.new
|
118
|
-
actor.expect(:processor_done, nil, [@processor])
|
119
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
120
|
-
2.times { @boss.expect(:async, actor, []) }
|
121
|
-
|
122
150
|
assert_raises TestException do
|
123
151
|
@processor.process(msg)
|
124
152
|
end
|
@@ -133,11 +161,6 @@ module Sidekiq
|
|
133
161
|
|
134
162
|
assert_equal 0, failures_count
|
135
163
|
|
136
|
-
actor = MiniTest::Mock.new
|
137
|
-
actor.expect(:processor_done, nil, [@processor])
|
138
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
139
|
-
2.times { @boss.expect(:async, actor, []) }
|
140
|
-
|
141
164
|
assert_raises TestException do
|
142
165
|
@processor.process(msg)
|
143
166
|
end
|
@@ -151,11 +174,6 @@ module Sidekiq
|
|
151
174
|
|
152
175
|
assert_equal 0, failures_count
|
153
176
|
|
154
|
-
actor = MiniTest::Mock.new
|
155
|
-
actor.expect(:processor_done, nil, [@processor])
|
156
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
157
|
-
2.times { @boss.expect(:async, actor, []) }
|
158
|
-
|
159
177
|
assert_raises TestException do
|
160
178
|
@processor.process(msg)
|
161
179
|
end
|
@@ -169,11 +187,6 @@ module Sidekiq
|
|
169
187
|
|
170
188
|
assert_equal 0, failures_count
|
171
189
|
|
172
|
-
actor = MiniTest::Mock.new
|
173
|
-
actor.expect(:processor_done, nil, [@processor])
|
174
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
175
|
-
2.times { @boss.expect(:async, actor, []) }
|
176
|
-
|
177
190
|
assert_raises TestException do
|
178
191
|
@processor.process(msg)
|
179
192
|
end
|
@@ -189,11 +202,6 @@ module Sidekiq
|
|
189
202
|
|
190
203
|
assert_equal 0, failures_count
|
191
204
|
|
192
|
-
actor = MiniTest::Mock.new
|
193
|
-
actor.expect(:processor_done, nil, [@processor])
|
194
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
195
|
-
2.times { @boss.expect(:async, actor, []) }
|
196
|
-
|
197
205
|
assert_raises TestException do
|
198
206
|
@processor.process(msg)
|
199
207
|
end
|
@@ -209,11 +217,6 @@ module Sidekiq
|
|
209
217
|
|
210
218
|
assert_equal 0, failures_count
|
211
219
|
|
212
|
-
actor = MiniTest::Mock.new
|
213
|
-
actor.expect(:processor_done, nil, [@processor])
|
214
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
215
|
-
2.times { @boss.expect(:async, actor, []) }
|
216
|
-
|
217
220
|
assert_raises TestException do
|
218
221
|
@processor.process(msg)
|
219
222
|
end
|
@@ -232,17 +235,13 @@ module Sidekiq
|
|
232
235
|
|
233
236
|
3.times do
|
234
237
|
boss = MiniTest::Mock.new
|
235
|
-
|
236
|
-
processor = ::Sidekiq::Processor.new(boss)
|
237
|
-
|
238
|
-
actor = MiniTest::Mock.new
|
239
|
-
actor.expect(:processor_done, nil, [processor])
|
240
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
241
|
-
2.times { boss.expect(:async, actor, []) }
|
238
|
+
processor = @provider.new_processor(boss)
|
242
239
|
|
243
240
|
assert_raises TestException do
|
244
241
|
processor.process(msg)
|
245
242
|
end
|
243
|
+
|
244
|
+
boss.verify
|
246
245
|
end
|
247
246
|
|
248
247
|
assert_equal 2, failures_count
|
@@ -259,11 +258,6 @@ module Sidekiq
|
|
259
258
|
|
260
259
|
assert_equal 0, Sidekiq::Failures.count
|
261
260
|
|
262
|
-
actor = MiniTest::Mock.new
|
263
|
-
actor.expect(:processor_done, nil, [@processor])
|
264
|
-
actor.expect(:real_thread, nil, [nil, nil])
|
265
|
-
@boss.expect(:async, actor, [])
|
266
|
-
|
267
261
|
assert_raises TestException do
|
268
262
|
@processor.process(msg)
|
269
263
|
end
|
data/test/test_helper.rb
CHANGED
data/test/web_extension_test.rb
CHANGED
@@ -5,7 +5,7 @@ module Sidekiq
|
|
5
5
|
describe "WebExtension" do
|
6
6
|
include Rack::Test::Methods
|
7
7
|
|
8
|
-
TOKEN =
|
8
|
+
TOKEN = SecureRandom.base64(32).freeze
|
9
9
|
|
10
10
|
def app
|
11
11
|
Sidekiq::Web
|
@@ -21,22 +21,22 @@ module Sidekiq
|
|
21
21
|
it 'can display home with failures tab' do
|
22
22
|
get '/'
|
23
23
|
|
24
|
-
last_response.status.must_equal 200
|
25
|
-
last_response.body.must_match(/Sidekiq/)
|
26
|
-
last_response.body.must_match(/Failures/)
|
24
|
+
_(last_response.status).must_equal 200
|
25
|
+
_(last_response.body).must_match(/Sidekiq/)
|
26
|
+
_(last_response.body).must_match(/Failures/)
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'can display failures page without any failures' do
|
30
30
|
get '/failures'
|
31
|
-
last_response.status.must_equal 200
|
32
|
-
last_response.body.must_match(/Failed Jobs/)
|
33
|
-
last_response.body.must_match(/No failed jobs found/)
|
31
|
+
_(last_response.status).must_equal 200
|
32
|
+
_(last_response.body).must_match(/Failed Jobs/)
|
33
|
+
_(last_response.body).must_match(/No failed jobs found/)
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'has the reset counter form and action' do
|
37
37
|
get '/failures'
|
38
|
-
last_response.body.must_match(/failures\/all\/reset/)
|
39
|
-
last_response.body.must_match(/Reset Counter/)
|
38
|
+
_(last_response.body).must_match(/failures\/all\/reset/)
|
39
|
+
_(last_response.body).must_match(/Reset Counter/)
|
40
40
|
end
|
41
41
|
|
42
42
|
describe 'when there are failures' do
|
@@ -46,97 +46,105 @@ module Sidekiq
|
|
46
46
|
end
|
47
47
|
|
48
48
|
it 'should be successful' do
|
49
|
-
last_response.status.must_equal 200
|
49
|
+
_(last_response.status).must_equal 200
|
50
50
|
end
|
51
51
|
|
52
52
|
it 'can display failures page with failures listed' do
|
53
|
-
last_response.body.must_match(/Failed Jobs/)
|
54
|
-
last_response.body.must_match(/HardWorker/)
|
55
|
-
last_response.body.must_match(/ArgumentError/)
|
56
|
-
last_response.body.wont_match(/No failed jobs found/)
|
53
|
+
_(last_response.body).must_match(/Failed Jobs/)
|
54
|
+
_(last_response.body).must_match(/HardWorker/)
|
55
|
+
_(last_response.body).must_match(/ArgumentError/)
|
56
|
+
_(last_response.body).wont_match(/No failed jobs found/)
|
57
57
|
end
|
58
58
|
|
59
59
|
it 'can reset counter' do
|
60
60
|
assert_equal failed_count, "1"
|
61
61
|
|
62
|
-
last_response.body.must_match(/HardWorker/)
|
62
|
+
_(last_response.body).must_match(/HardWorker/)
|
63
63
|
|
64
64
|
post '/failures/all/reset'
|
65
|
-
last_response.status.must_equal 302
|
66
|
-
last_response.location.must_match(/failures$/)
|
65
|
+
_(last_response.status).must_equal 302
|
66
|
+
_(last_response.location).must_match(/failures$/)
|
67
67
|
|
68
68
|
get '/failures'
|
69
|
-
last_response.status.must_equal 200
|
70
|
-
last_response.body.must_match(/HardWorker/)
|
69
|
+
_(last_response.status).must_equal 200
|
70
|
+
_(last_response.body).must_match(/HardWorker/)
|
71
71
|
|
72
72
|
assert_equal failed_count, "0"
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'has the delete all form and action' do
|
76
|
-
last_response.body.must_match(/failures\/all\/delete/)
|
77
|
-
last_response.body.must_match(/Delete All/)
|
76
|
+
_(last_response.body).must_match(/failures\/all\/delete/)
|
77
|
+
_(last_response.body).must_match(/Delete All/)
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'can delete all failures' do
|
81
81
|
assert_equal failed_count, "1"
|
82
82
|
|
83
|
-
last_response.body.must_match(/HardWorker/)
|
83
|
+
_(last_response.body).must_match(/HardWorker/)
|
84
84
|
|
85
85
|
post '/failures/all/delete'
|
86
|
-
last_response.status.must_equal 302
|
87
|
-
last_response.location.must_match(/failures$/)
|
86
|
+
_(last_response.status).must_equal 302
|
87
|
+
_(last_response.location).must_match(/failures$/)
|
88
88
|
|
89
89
|
get '/failures'
|
90
|
-
last_response.status.must_equal 200
|
91
|
-
last_response.body.must_match(/No failed jobs found/)
|
90
|
+
_(last_response.status).must_equal 200
|
91
|
+
_(last_response.body).must_match(/No failed jobs found/)
|
92
92
|
|
93
93
|
assert_equal failed_count, "1"
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'has the retry all form and action' do
|
97
|
-
last_response.body.must_match(/failures\/all\/retry/)
|
98
|
-
last_response.body.must_match(/Retry All/)
|
97
|
+
_(last_response.body).must_match(/failures\/all\/retry/)
|
98
|
+
_(last_response.body).must_match(/Retry All/)
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'can retry all failures' do
|
102
102
|
assert_equal failed_count, "1"
|
103
103
|
|
104
|
-
last_response.body.must_match(/HardWorker/)
|
104
|
+
_(last_response.body).must_match(/HardWorker/)
|
105
105
|
post '/failures/all/retry'
|
106
|
-
last_response.status.must_equal 302
|
107
|
-
last_response.location.must_match(/failures/)
|
106
|
+
_(last_response.status).must_equal 302
|
107
|
+
_(last_response.location).must_match(/failures/)
|
108
108
|
|
109
109
|
get '/failures'
|
110
|
-
last_response.status.must_equal 200
|
111
|
-
last_response.body.must_match(/No failed jobs found/)
|
110
|
+
_(last_response.status).must_equal 200
|
111
|
+
_(last_response.body).must_match(/No failed jobs found/)
|
112
112
|
end
|
113
113
|
|
114
114
|
it 'can delete failure from the list' do
|
115
115
|
assert_equal failed_count, "1"
|
116
116
|
|
117
|
-
last_response.body.must_match(/HardWorker/)
|
117
|
+
_(last_response.body).must_match(/HardWorker/)
|
118
118
|
|
119
119
|
post '/failures', { :key => [failure_score], :delete => 'Delete' }
|
120
|
-
last_response.status.must_equal 302
|
121
|
-
last_response.location.must_match(/failures/)
|
120
|
+
_(last_response.status).must_equal 302
|
121
|
+
_(last_response.location).must_match(/failures/)
|
122
122
|
|
123
123
|
get '/failures'
|
124
|
-
last_response.status.must_equal 200
|
125
|
-
last_response.body.must_match(/No failed jobs found/)
|
124
|
+
_(last_response.status).must_equal 200
|
125
|
+
_(last_response.body).must_match(/No failed jobs found/)
|
126
126
|
end
|
127
127
|
|
128
128
|
it 'can retry failure from the list' do
|
129
129
|
assert_equal failed_count, "1"
|
130
130
|
|
131
|
-
last_response.body.must_match(/HardWorker/)
|
131
|
+
_(last_response.body).must_match(/HardWorker/)
|
132
132
|
|
133
133
|
post '/failures', { :key => [failure_score], :retry => 'Retry Now' }
|
134
|
-
last_response.status.must_equal 302
|
135
|
-
last_response.location.must_match(/failures/)
|
134
|
+
_(last_response.status).must_equal 302
|
135
|
+
_(last_response.location).must_match(/failures/)
|
136
136
|
|
137
137
|
get '/failures'
|
138
|
-
last_response.status.must_equal 200
|
139
|
-
last_response.body.must_match(/No failed jobs found/)
|
138
|
+
_(last_response.status).must_equal 200
|
139
|
+
_(last_response.body).must_match(/No failed jobs found/)
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'can handle failures with nil error_message' do
|
143
|
+
create_sample_failure(error_message: nil)
|
144
|
+
|
145
|
+
get '/failures'
|
146
|
+
|
147
|
+
_(last_response.status).must_equal 200
|
140
148
|
end
|
141
149
|
end
|
142
150
|
|
@@ -147,38 +155,38 @@ module Sidekiq
|
|
147
155
|
end
|
148
156
|
|
149
157
|
it 'should be successful' do
|
150
|
-
last_response.status.must_equal 200
|
158
|
+
_(last_response.status).must_equal 200
|
151
159
|
end
|
152
160
|
|
153
161
|
it 'can display failure page' do
|
154
|
-
last_response.body.must_match(/Job/)
|
155
|
-
last_response.body.must_match(/HardWorker/)
|
156
|
-
last_response.body.must_match(/ArgumentError/)
|
157
|
-
last_response.body.must_match(/file1/)
|
162
|
+
_(last_response.body).must_match(/Job/)
|
163
|
+
_(last_response.body).must_match(/HardWorker/)
|
164
|
+
_(last_response.body).must_match(/ArgumentError/)
|
165
|
+
_(last_response.body).must_match(/file1/)
|
158
166
|
end
|
159
167
|
|
160
168
|
it 'can delete failure' do
|
161
|
-
last_response.body.must_match(/HardWorker/)
|
169
|
+
_(last_response.body).must_match(/HardWorker/)
|
162
170
|
|
163
171
|
post "/failures/#{failure_score}", :delete => 'Delete'
|
164
|
-
last_response.status.must_equal 302
|
165
|
-
last_response.location.must_match(/failures/)
|
172
|
+
_(last_response.status).must_equal 302
|
173
|
+
_(last_response.location).must_match(/failures/)
|
166
174
|
|
167
175
|
get "/failures/#{failure_score}"
|
168
|
-
last_response.status.must_equal 302
|
169
|
-
last_response.location.must_match(/failures/)
|
176
|
+
_(last_response.status).must_equal 302
|
177
|
+
_(last_response.location).must_match(/failures/)
|
170
178
|
end
|
171
179
|
|
172
180
|
it 'can retry failure' do
|
173
|
-
last_response.body.must_match(/HardWorker/)
|
181
|
+
_(last_response.body).must_match(/HardWorker/)
|
174
182
|
|
175
183
|
post "/failures/#{failure_score}", :retry => 'Retry Now'
|
176
|
-
last_response.status.must_equal 302
|
177
|
-
last_response.location.must_match(/failures/)
|
184
|
+
_(last_response.status).must_equal 302
|
185
|
+
_(last_response.location).must_match(/failures/)
|
178
186
|
|
179
187
|
get "/failures/#{failure_score}"
|
180
|
-
last_response.status.must_equal 302
|
181
|
-
last_response.location.must_match(/failures/)
|
188
|
+
_(last_response.status).must_equal 302
|
189
|
+
_(last_response.location).must_match(/failures/)
|
182
190
|
end
|
183
191
|
|
184
192
|
if defined? Sidekiq::Pro
|
@@ -186,7 +194,7 @@ module Sidekiq
|
|
186
194
|
create_sample_failure
|
187
195
|
post '/filter/failures', substr: 'new'
|
188
196
|
|
189
|
-
last_response.status.must_equal 200
|
197
|
+
_(last_response.status).must_equal 200
|
190
198
|
end
|
191
199
|
end
|
192
200
|
end
|
@@ -199,11 +207,11 @@ module Sidekiq
|
|
199
207
|
end
|
200
208
|
|
201
209
|
it 'can escape arguments' do
|
202
|
-
last_response.body.must_match(/"<h1>omg</h1>"/)
|
210
|
+
_(last_response.body).must_match(/"<h1>omg</h1>"/)
|
203
211
|
end
|
204
212
|
|
205
213
|
it 'can escape error message' do
|
206
|
-
last_response.body.must_match(/ArgumentError: <p>wow</p>/)
|
214
|
+
_(last_response.body).must_match(/ArgumentError: <p>wow</p>/)
|
207
215
|
end
|
208
216
|
end
|
209
217
|
|
@@ -214,8 +222,8 @@ module Sidekiq
|
|
214
222
|
end
|
215
223
|
|
216
224
|
it 'should be successful' do
|
217
|
-
last_response.status.must_equal 200
|
218
|
-
last_response.body.wont_match(/No failed jobs found/)
|
225
|
+
_(last_response.status).must_equal 200
|
226
|
+
_(last_response.body).wont_match(/No failed jobs found/)
|
219
227
|
end
|
220
228
|
end
|
221
229
|
|
@@ -226,8 +234,8 @@ module Sidekiq
|
|
226
234
|
end
|
227
235
|
|
228
236
|
it 'should be successful' do
|
229
|
-
last_response.status.must_equal 200
|
230
|
-
last_response.body.wont_match(/No failed jobs found/)
|
237
|
+
_(last_response.status).must_equal 200
|
238
|
+
_(last_response.body).wont_match(/No failed jobs found/)
|
231
239
|
end
|
232
240
|
end
|
233
241
|
end
|
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: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Silveira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -101,8 +101,9 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".github/dependabot.yml"
|
105
|
+
- ".github/workflows/ci.yml"
|
104
106
|
- ".gitignore"
|
105
|
-
- ".travis.yml"
|
106
107
|
- CHANGELOG.md
|
107
108
|
- Gemfile
|
108
109
|
- LICENSE
|
@@ -114,6 +115,7 @@ files:
|
|
114
115
|
- lib/sidekiq/failures/locales/en.yml
|
115
116
|
- lib/sidekiq/failures/locales/ja.yml
|
116
117
|
- lib/sidekiq/failures/locales/pt-BR.yml
|
118
|
+
- lib/sidekiq/failures/locales/zh-cn.yml
|
117
119
|
- lib/sidekiq/failures/middleware.rb
|
118
120
|
- lib/sidekiq/failures/sorted_entry.rb
|
119
121
|
- lib/sidekiq/failures/version.rb
|
@@ -126,9 +128,10 @@ files:
|
|
126
128
|
- test/test_helper.rb
|
127
129
|
- test/web_extension_test.rb
|
128
130
|
homepage: https://github.com/mhfs/sidekiq-failures/
|
129
|
-
licenses:
|
131
|
+
licenses:
|
132
|
+
- MIT
|
130
133
|
metadata: {}
|
131
|
-
post_install_message:
|
134
|
+
post_install_message:
|
132
135
|
rdoc_options: []
|
133
136
|
require_paths:
|
134
137
|
- lib
|
@@ -143,14 +146,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
146
|
- !ruby/object:Gem::Version
|
144
147
|
version: '0'
|
145
148
|
requirements: []
|
146
|
-
|
147
|
-
|
148
|
-
signing_key:
|
149
|
+
rubygems_version: 3.3.7
|
150
|
+
signing_key:
|
149
151
|
specification_version: 4
|
150
152
|
summary: Keeps track of Sidekiq failed jobs and adds a tab to the Web UI to let you
|
151
153
|
browse them. Makes use of Sidekiq's custom tabs and middleware chain.
|
152
|
-
test_files:
|
153
|
-
- test/failures_test.rb
|
154
|
-
- test/middleware_test.rb
|
155
|
-
- test/test_helper.rb
|
156
|
-
- test/web_extension_test.rb
|
154
|
+
test_files: []
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
cache: bundler
|
4
|
-
services:
|
5
|
-
- redis-server
|
6
|
-
before_install:
|
7
|
-
- gem install bundler
|
8
|
-
- gem update bundler
|
9
|
-
rvm:
|
10
|
-
- jruby-9.1.6.0
|
11
|
-
- 2.2.4
|
12
|
-
- 2.3.0
|
13
|
-
- 2.4.0
|
14
|
-
env:
|
15
|
-
matrix:
|
16
|
-
- SIDEKIQ_VERSION="~> 4.0"
|
17
|
-
- SIDEKIQ_VERSION="~> 4.2"
|
18
|
-
- SIDEKIQ_VERSION="~> 5.0"
|
19
|
-
matrix:
|
20
|
-
allow_failures:
|
21
|
-
- rvm: jruby-9.1.6.0
|