sidekiq-failures 0.4.5 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cf2e8b86ea584dc2d01d303a8b810a3527da318
4
- data.tar.gz: ea8731360ed096a6f6b885cb3f078a80bb96747e
3
+ metadata.gz: e856dd820aab39c74c1206b00aecebfaa2b1532d
4
+ data.tar.gz: 0c639951b4f5f9b6e0621e59a13fd839c67c7400
5
5
  SHA512:
6
- metadata.gz: dd021e8afcbd6a59c8d725d2954f7d45cbb50475b3c342b8e5d00533dd3c72594548d4fdb197e3d5a3cd51d158f000c050da57d353ef294c67bfe7880243dad8
7
- data.tar.gz: 422b175ead022b822ae08838a03365f22e6e4a0a2213ff8f9c2756ed3f41b14c58e9e7f950f32adce8d8f25e440c3a5a8b78753798a4162ddf8626cd9bb2c977
6
+ metadata.gz: 99093da61f43fa228f73cf872e3e2a8d38a38745acdf7ca0bddca02de9e36cce1092f8ab3cb0a9f0cc20823a37ac21743fecedc2d17c1a57194fa9c9670e951e
7
+ data.tar.gz: b04bf490ec4caa513fee332c21fb317bed2cf41192b0da42199aa79f5d7ec19c0713a4fde3047b091c4650efd7a4db059de452ac40f0e1f0aff191ac47d1ede2
@@ -1,18 +1,21 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache: bundler
2
4
  services:
3
5
  - redis-server
6
+ before_install:
7
+ - gem install bundler
8
+ - gem update bundler
4
9
  rvm:
5
- - 1.9.3
6
- - jruby-19mode
7
- - 2.0.0
8
- - 2.1
10
+ - jruby-9.1.6.0
11
+ - 2.2.4
12
+ - 2.3.0
13
+ - 2.4.0
9
14
  env:
10
15
  matrix:
11
- - SIDEKIQ_VERSION="~> 2.16"
12
- - SIDEKIQ_VERSION="~> 2.17"
13
- - SIDEKIQ_VERSION="~> 3.0"
14
- - SIDEKIQ_VERSION="~> 3.1"
16
+ - SIDEKIQ_VERSION="~> 4.0"
17
+ - SIDEKIQ_VERSION="~> 4.2"
18
+ - SIDEKIQ_VERSION="~> 5.0"
15
19
  matrix:
16
20
  allow_failures:
17
- - rvm: 1.9.3
18
- - rvm: jruby-19mode
21
+ - rvm: jruby-9.1.6.0
@@ -1,5 +1,13 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 1.0.0
4
+
5
+ * WebUI improvements (@bbtfr)
6
+ * Use ActiveJob to display info when available (@dreyks)
7
+ * New locales (@ryohashimoto @gurgelrenan)
8
+ * Sidekiq 4 and higher compatibility (@davekrupinski )
9
+ * Sidekiq 5 fixes (@fidelisrafael)
10
+
3
11
  ## 0.4.5
4
12
 
5
13
  * Limit error message to 500 symbols (@antonzaytsev)
data/README.md CHANGED
@@ -136,7 +136,7 @@ Sidekiq::Failures.reset_failures
136
136
 
137
137
  ## Dependencies
138
138
 
139
- Depends on Sidekiq >= 2.16.0
139
+ Depends on Sidekiq >= 4.0.0
140
140
 
141
141
  ## Contributing
142
142
 
@@ -5,6 +5,7 @@ rescue LoadError
5
5
  end
6
6
 
7
7
  require "sidekiq/api"
8
+ require "sidekiq/version"
8
9
  require "sidekiq/failures/version"
9
10
  require "sidekiq/failures/sorted_entry"
10
11
  require "sidekiq/failures/failure_set"
@@ -47,9 +48,11 @@ module Sidekiq
47
48
 
48
49
  # Fetches the failures max count value
49
50
  def self.failures_max_count
50
- return 1000 if @failures_max_count.nil?
51
-
52
- @failures_max_count
51
+ if !instance_variable_defined?(:@failures_max_count) || @failures_max_count.nil?
52
+ 1000
53
+ else
54
+ @failures_max_count
55
+ end
53
56
  end
54
57
 
55
58
  module Failures
@@ -62,12 +65,23 @@ module Sidekiq
62
65
  def self.count
63
66
  Sidekiq.redis {|r| r.zcard(LIST_KEY) }
64
67
  end
68
+
69
+ def self.retry_middleware_class
70
+ if Gem::Version.new(Sidekiq::VERSION) >= Gem::Version.new('5.0.0')
71
+ require 'sidekiq/job_retry'
72
+ Sidekiq::JobRetry
73
+ else
74
+ require 'sidekiq/middleware/server/retry_jobs'
75
+ Sidekiq::Middleware::Server::RetryJobs
76
+ end
77
+ end
78
+
65
79
  end
66
80
  end
67
81
 
68
82
  Sidekiq.configure_server do |config|
69
83
  config.server_middleware do |chain|
70
- chain.insert_before Sidekiq::Middleware::Server::RetryJobs,
84
+ chain.insert_before Sidekiq::Failures.retry_middleware_class,
71
85
  Sidekiq::Failures::Middleware
72
86
  end
73
87
  end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ ja:
3
+ FailedJobs: 失敗したジョブ
4
+ FailedAt: 失敗した日時
5
+ ResetCounter: カウンターをリセット
6
+ NoFailedJobsFound: 失敗したジョブはありません
@@ -0,0 +1,5 @@
1
+ pt-BR:
2
+ FailedJobs: Processos Falhos
3
+ FailedAt: Falhou em
4
+ ResetCounter: Resetar contador
5
+ NoFailedJobsFound: Nenhum Processo falho encontrado
@@ -80,11 +80,12 @@ module Sidekiq
80
80
  end
81
81
 
82
82
  def retry_middleware
83
- @retry_middleware ||= Sidekiq::Middleware::Server::RetryJobs.new
83
+ @retry_middleware ||=
84
+ Sidekiq::Failures.retry_middleware_class.new
84
85
  end
85
86
 
86
87
  def default_max_retries
87
- Sidekiq::Middleware::Server::RetryJobs::DEFAULT_MAX_RETRY_ATTEMPTS
88
+ Sidekiq::Failures.retry_middleware_class::DEFAULT_MAX_RETRY_ATTEMPTS
88
89
  end
89
90
 
90
91
  def hostname
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Failures
3
- VERSION = "0.4.5"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -21,11 +21,11 @@
21
21
  <input type="checkbox" class="check_all" />
22
22
  </label>
23
23
  </th>
24
- <th style="width: 20%"><%= t('Worker') %></th>
25
- <th style="width: 10%"><%= t('Arguments') %></th>
26
- <th style="width: 10%"><%= t('Queue') %></th>
27
- <th style="width: 10%"><%= t('FailedAt') %></th>
28
- <th style="width: 50%"><%= t('Error') %></th>
24
+ <th><%= t('FailedAt') %></th>
25
+ <th><%= t('Queue') %></th>
26
+ <th><%= t('Worker') %></th>
27
+ <th><%= t('Arguments') %></th>
28
+ <th><%= t('Error') %></th>
29
29
  </tr>
30
30
  </thead>
31
31
  <% @failures.each do |entry| %>
@@ -35,14 +35,14 @@
35
35
  <input type='checkbox' name='key[]' value='<%= job_params(entry.item, entry.score) %>' />
36
36
  </label>
37
37
  </td>
38
- <td><a href="<%= root_path %>failures/<%= job_params(entry.item, entry.score) %>"><%= entry.klass %></a></td>
38
+ <td><a href="<%= root_path %>failures/<%= job_params(entry.item, entry.score) %>"><%= safe_relative_time(entry['failed_at']) %></a></td>
39
39
  <td>
40
- <div class="args"><%= display_args(entry.args) %></div>
40
+ <a href="<%= root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
41
41
  </td>
42
+ <td><%= entry.respond_to?(:display_class) ? entry.display_class : entry.klass %></td>
42
43
  <td>
43
- <a href="<%= root_path %>queues/<%= entry.queue %>"><%= entry.queue %></a>
44
+ <div class="args"><%= display_args(entry.respond_to?(:display_args) ? entry.display_args : entry.args) %></div>
44
45
  </td>
45
- <td><%= safe_relative_time(entry['failed_at']) %></td>
46
46
  <td style="overflow: auto; padding: 10px;">
47
47
  <a class="backtrace" href="#" onclick="$(this).next().toggle(); return false">
48
48
  <%= h entry['error_class'] %>: <%= h entry['error_message'].size > 500 ? entry['error_message'][0..500] + '...' : entry['error_message'] %>
@@ -19,7 +19,7 @@ module Sidekiq
19
19
 
20
20
  app.get "/failures" do
21
21
  @count = (params[:count] || 25).to_i
22
- (@current_page, @total_size, @failures) = page(LIST_KEY, params[:page], @count)
22
+ (@current_page, @total_size, @failures) = page(LIST_KEY, params[:page], @count, :reverse => true)
23
23
  @failures = @failures.map {|msg, score| Sidekiq::SortedEntry.new(nil, score, msg) }
24
24
 
25
25
  render(:erb, File.read(File.join(view_path, "failures.erb")))
@@ -78,6 +78,17 @@ module Sidekiq
78
78
  FailureSet.new.retry_all_failures
79
79
  redirect "#{root_path}failures"
80
80
  end
81
+
82
+ app.get '/filter/failures' do
83
+ redirect "#{root_path}failures"
84
+ end
85
+
86
+ app.post '/filter/failures' do
87
+ @failures = Sidekiq::Failures::FailureSet.new.scan("*#{params[:substr]}*")
88
+ @current_page = 1
89
+ @count = @total_size = @failures.size
90
+ render(:erb, File.read(File.join(view_path, "failures.erb")))
91
+ end
81
92
  end
82
93
  end
83
94
  end
@@ -15,8 +15,9 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Sidekiq::Failures::VERSION
17
17
 
18
- gem.add_dependency "sidekiq", ">= 2.16.0"
18
+ gem.add_dependency "sidekiq", ">= 4.0.0"
19
19
 
20
+ gem.add_development_dependency "minitest"
20
21
  gem.add_development_dependency "rake"
21
22
  gem.add_development_dependency "rack-test"
22
23
  gem.add_development_dependency "sprockets"
@@ -0,0 +1,16 @@
1
+ require "test_helper"
2
+
3
+ module Sidekiq
4
+ describe Failures do
5
+ describe '.retry_middleware_class' do
6
+ it 'returns based on Sidekiq::VERISON' do
7
+ case Sidekiq::VERSION[0]
8
+ when '5'
9
+ assert_equal Failures.retry_middleware_class, Sidekiq::JobRetry
10
+ when '4'
11
+ assert_equal Failures.retry_middleware_class, Sidekiq::Middleware::Server::RetryJobs
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -4,9 +4,9 @@ module Sidekiq
4
4
  module Failures
5
5
  describe "Middleware" do
6
6
  before do
7
- Celluloid.boot
8
7
  $invokes = 0
9
8
  @boss = MiniTest::Mock.new
9
+ 2.times { @boss.expect(:options, {:queues => ['default'] }, []) }
10
10
  @processor = ::Sidekiq::Processor.new(@boss)
11
11
  Sidekiq.server_middleware {|chain| chain.add Sidekiq::Failures::Middleware }
12
12
  Sidekiq.redis = REDIS
@@ -44,7 +44,7 @@ module Sidekiq
44
44
 
45
45
  actor = MiniTest::Mock.new
46
46
  actor.expect(:processor_done, nil, [@processor])
47
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
47
+ actor.expect(:real_thread, nil, [nil, nil])
48
48
  2.times { @boss.expect(:async, actor, []) }
49
49
 
50
50
  assert_raises TestException do
@@ -62,7 +62,7 @@ module Sidekiq
62
62
 
63
63
  actor = MiniTest::Mock.new
64
64
  actor.expect(:processor_done, nil, [@processor])
65
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
65
+ actor.expect(:real_thread, nil, [nil, nil])
66
66
  2.times { @boss.expect(:async, actor, []) }
67
67
 
68
68
  assert_raises TestException do
@@ -80,8 +80,7 @@ module Sidekiq
80
80
 
81
81
  actor = MiniTest::Mock.new
82
82
  actor.expect(:processor_done, nil, [@processor])
83
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
84
- 2.times { @boss.expect(:async, actor, []) }
83
+ actor.expect(:real_thread, nil, [nil, nil])
85
84
 
86
85
  @processor.process(msg)
87
86
  @boss.verify
@@ -97,7 +96,7 @@ module Sidekiq
97
96
 
98
97
  actor = MiniTest::Mock.new
99
98
  actor.expect(:processor_done, nil, [@processor])
100
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
99
+ actor.expect(:real_thread, nil, [nil, nil])
101
100
  2.times { @boss.expect(:async, actor, []) }
102
101
 
103
102
  assert_raises TestException do
@@ -117,7 +116,7 @@ module Sidekiq
117
116
 
118
117
  actor = MiniTest::Mock.new
119
118
  actor.expect(:processor_done, nil, [@processor])
120
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
119
+ actor.expect(:real_thread, nil, [nil, nil])
121
120
  2.times { @boss.expect(:async, actor, []) }
122
121
 
123
122
  assert_raises TestException do
@@ -136,7 +135,7 @@ module Sidekiq
136
135
 
137
136
  actor = MiniTest::Mock.new
138
137
  actor.expect(:processor_done, nil, [@processor])
139
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
138
+ actor.expect(:real_thread, nil, [nil, nil])
140
139
  2.times { @boss.expect(:async, actor, []) }
141
140
 
142
141
  assert_raises TestException do
@@ -154,7 +153,7 @@ module Sidekiq
154
153
 
155
154
  actor = MiniTest::Mock.new
156
155
  actor.expect(:processor_done, nil, [@processor])
157
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
156
+ actor.expect(:real_thread, nil, [nil, nil])
158
157
  2.times { @boss.expect(:async, actor, []) }
159
158
 
160
159
  assert_raises TestException do
@@ -172,7 +171,7 @@ module Sidekiq
172
171
 
173
172
  actor = MiniTest::Mock.new
174
173
  actor.expect(:processor_done, nil, [@processor])
175
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
174
+ actor.expect(:real_thread, nil, [nil, nil])
176
175
  2.times { @boss.expect(:async, actor, []) }
177
176
 
178
177
  assert_raises TestException do
@@ -192,7 +191,7 @@ module Sidekiq
192
191
 
193
192
  actor = MiniTest::Mock.new
194
193
  actor.expect(:processor_done, nil, [@processor])
195
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
194
+ actor.expect(:real_thread, nil, [nil, nil])
196
195
  2.times { @boss.expect(:async, actor, []) }
197
196
 
198
197
  assert_raises TestException do
@@ -212,7 +211,7 @@ module Sidekiq
212
211
 
213
212
  actor = MiniTest::Mock.new
214
213
  actor.expect(:processor_done, nil, [@processor])
215
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
214
+ actor.expect(:real_thread, nil, [nil, nil])
216
215
  2.times { @boss.expect(:async, actor, []) }
217
216
 
218
217
  assert_raises TestException do
@@ -233,11 +232,12 @@ module Sidekiq
233
232
 
234
233
  3.times do
235
234
  boss = MiniTest::Mock.new
235
+ 2.times { boss.expect(:options, {:queues => ['default'] }, []) }
236
236
  processor = ::Sidekiq::Processor.new(boss)
237
237
 
238
238
  actor = MiniTest::Mock.new
239
239
  actor.expect(:processor_done, nil, [processor])
240
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
240
+ actor.expect(:real_thread, nil, [nil, nil])
241
241
  2.times { boss.expect(:async, actor, []) }
242
242
 
243
243
  assert_raises TestException do
@@ -261,7 +261,7 @@ module Sidekiq
261
261
 
262
262
  actor = MiniTest::Mock.new
263
263
  actor.expect(:processor_done, nil, [@processor])
264
- actor.expect(:real_thread, nil, [nil, Celluloid::Thread])
264
+ actor.expect(:real_thread, nil, [nil, nil])
265
265
  @boss.expect(:async, actor, [])
266
266
 
267
267
  assert_raises TestException do
@@ -1,5 +1,4 @@
1
- Encoding.default_external = Encoding::UTF_8
2
- Encoding.default_internal = Encoding::UTF_8
1
+ $TESTING = true
3
2
 
4
3
  require "minitest/autorun"
5
4
  require "minitest/spec"
@@ -7,14 +6,12 @@ require "minitest/mock"
7
6
 
8
7
  require "rack/test"
9
8
 
10
- require "celluloid"
11
9
  require "sidekiq"
12
10
  require "sidekiq-failures"
13
11
  require "sidekiq/processor"
14
12
  require "sidekiq/fetch"
15
13
  require "sidekiq/cli"
16
14
 
17
- Celluloid.logger = nil
18
15
  Sidekiq.logger.level = Logger::ERROR
19
16
 
20
- REDIS = Sidekiq::RedisConnection.create(:url => "redis://localhost/15", :namespace => 'sidekiq_failures_test')
17
+ REDIS = Sidekiq::RedisConnection.create(url: "redis://localhost/15")
@@ -5,11 +5,15 @@ module Sidekiq
5
5
  describe "WebExtension" do
6
6
  include Rack::Test::Methods
7
7
 
8
+ TOKEN = rand(2**128-1).freeze
9
+
8
10
  def app
9
11
  Sidekiq::Web
10
12
  end
11
13
 
12
14
  before do
15
+ env 'rack.session', { csrf: TOKEN }
16
+ env 'HTTP_X_CSRF_TOKEN', TOKEN
13
17
  Sidekiq.redis = REDIS
14
18
  Sidekiq.redis {|c| c.flushdb }
15
19
  end
@@ -18,21 +22,21 @@ module Sidekiq
18
22
  get '/'
19
23
 
20
24
  last_response.status.must_equal 200
21
- last_response.body.must_match /Sidekiq/
22
- last_response.body.must_match /Failures/
25
+ last_response.body.must_match(/Sidekiq/)
26
+ last_response.body.must_match(/Failures/)
23
27
  end
24
28
 
25
29
  it 'can display failures page without any failures' do
26
30
  get '/failures'
27
31
  last_response.status.must_equal 200
28
- last_response.body.must_match /Failed Jobs/
29
- last_response.body.must_match /No failed jobs found/
32
+ last_response.body.must_match(/Failed Jobs/)
33
+ last_response.body.must_match(/No failed jobs found/)
30
34
  end
31
35
 
32
36
  it 'has the reset counter form and action' do
33
37
  get '/failures'
34
- last_response.body.must_match /failures\/all\/reset/
35
- last_response.body.must_match /Reset Counter/
38
+ last_response.body.must_match(/failures\/all\/reset/)
39
+ last_response.body.must_match(/Reset Counter/)
36
40
  end
37
41
 
38
42
  describe 'when there are failures' do
@@ -46,61 +50,61 @@ module Sidekiq
46
50
  end
47
51
 
48
52
  it 'can display failures page with failures listed' do
49
- last_response.body.must_match /Failed Jobs/
50
- last_response.body.must_match /HardWorker/
51
- last_response.body.must_match /ArgumentError/
52
- 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/)
53
57
  end
54
58
 
55
59
  it 'can reset counter' do
56
60
  assert_equal failed_count, "1"
57
61
 
58
- last_response.body.must_match /HardWorker/
62
+ last_response.body.must_match(/HardWorker/)
59
63
 
60
64
  post '/failures/all/reset'
61
65
  last_response.status.must_equal 302
62
- last_response.location.must_match /failures$/
66
+ last_response.location.must_match(/failures$/)
63
67
 
64
68
  get '/failures'
65
69
  last_response.status.must_equal 200
66
- last_response.body.must_match /HardWorker/
70
+ last_response.body.must_match(/HardWorker/)
67
71
 
68
72
  assert_equal failed_count, "0"
69
73
  end
70
74
 
71
75
  it 'has the delete all form and action' do
72
- last_response.body.must_match /failures\/all\/delete/
73
- last_response.body.must_match /Delete All/
76
+ last_response.body.must_match(/failures\/all\/delete/)
77
+ last_response.body.must_match(/Delete All/)
74
78
  end
75
79
 
76
80
  it 'can delete all failures' do
77
81
  assert_equal failed_count, "1"
78
82
 
79
- last_response.body.must_match /HardWorker/
83
+ last_response.body.must_match(/HardWorker/)
80
84
 
81
85
  post '/failures/all/delete'
82
86
  last_response.status.must_equal 302
83
- last_response.location.must_match /failures$/
87
+ last_response.location.must_match(/failures$/)
84
88
 
85
89
  get '/failures'
86
90
  last_response.status.must_equal 200
87
- last_response.body.must_match /No failed jobs found/
91
+ last_response.body.must_match(/No failed jobs found/)
88
92
 
89
93
  assert_equal failed_count, "1"
90
94
  end
91
95
 
92
96
  it 'has the retry all form and action' do
93
- last_response.body.must_match /failures\/all\/retry/
94
- last_response.body.must_match /Retry All/
97
+ last_response.body.must_match(/failures\/all\/retry/)
98
+ last_response.body.must_match(/Retry All/)
95
99
  end
96
100
 
97
101
  it 'can retry all failures' do
98
102
  assert_equal failed_count, "1"
99
103
 
100
- last_response.body.must_match /HardWorker/
104
+ last_response.body.must_match(/HardWorker/)
101
105
  post '/failures/all/retry'
102
106
  last_response.status.must_equal 302
103
- last_response.location.must_match /failures/
107
+ last_response.location.must_match(/failures/)
104
108
 
105
109
  get '/failures'
106
110
  last_response.status.must_equal 200
@@ -110,29 +114,29 @@ module Sidekiq
110
114
  it 'can delete failure from the list' do
111
115
  assert_equal failed_count, "1"
112
116
 
113
- last_response.body.must_match /HardWorker/
117
+ last_response.body.must_match(/HardWorker/)
114
118
 
115
119
  post '/failures', { :key => [failure_score], :delete => 'Delete' }
116
120
  last_response.status.must_equal 302
117
- last_response.location.must_match /failures/
121
+ last_response.location.must_match(/failures/)
118
122
 
119
123
  get '/failures'
120
124
  last_response.status.must_equal 200
121
- last_response.body.must_match /No failed jobs found/
125
+ last_response.body.must_match(/No failed jobs found/)
122
126
  end
123
127
 
124
128
  it 'can retry failure from the list' do
125
129
  assert_equal failed_count, "1"
126
130
 
127
- last_response.body.must_match /HardWorker/
131
+ last_response.body.must_match(/HardWorker/)
128
132
 
129
133
  post '/failures', { :key => [failure_score], :retry => 'Retry Now' }
130
134
  last_response.status.must_equal 302
131
- last_response.location.must_match /failures/
135
+ last_response.location.must_match(/failures/)
132
136
 
133
137
  get '/failures'
134
138
  last_response.status.must_equal 200
135
- last_response.body.must_match /No failed jobs found/
139
+ last_response.body.must_match(/No failed jobs found/)
136
140
  end
137
141
  end
138
142
 
@@ -147,34 +151,43 @@ module Sidekiq
147
151
  end
148
152
 
149
153
  it 'can display failure page' do
150
- last_response.body.must_match /Job/
151
- last_response.body.must_match /HardWorker/
152
- last_response.body.must_match /ArgumentError/
153
- last_response.body.must_match /file1/
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/)
154
158
  end
155
159
 
156
160
  it 'can delete failure' do
157
- last_response.body.must_match /HardWorker/
161
+ last_response.body.must_match(/HardWorker/)
158
162
 
159
163
  post "/failures/#{failure_score}", :delete => 'Delete'
160
164
  last_response.status.must_equal 302
161
- last_response.location.must_match /failures/
165
+ last_response.location.must_match(/failures/)
162
166
 
163
167
  get "/failures/#{failure_score}"
164
168
  last_response.status.must_equal 302
165
- last_response.location.must_match /failures/
169
+ last_response.location.must_match(/failures/)
166
170
  end
167
171
 
168
172
  it 'can retry failure' do
169
- last_response.body.must_match /HardWorker/
173
+ last_response.body.must_match(/HardWorker/)
170
174
 
171
175
  post "/failures/#{failure_score}", :retry => 'Retry Now'
172
176
  last_response.status.must_equal 302
173
- last_response.location.must_match /failures/
177
+ last_response.location.must_match(/failures/)
174
178
 
175
179
  get "/failures/#{failure_score}"
176
180
  last_response.status.must_equal 302
177
- last_response.location.must_match /failures/
181
+ last_response.location.must_match(/failures/)
182
+ end
183
+
184
+ if defined? Sidekiq::Pro
185
+ it 'can filter failure' do
186
+ create_sample_failure
187
+ post '/filter/failures', substr: 'new'
188
+
189
+ last_response.status.must_equal 200
190
+ end
178
191
  end
179
192
  end
180
193
 
@@ -186,11 +199,11 @@ module Sidekiq
186
199
  end
187
200
 
188
201
  it 'can escape arguments' do
189
- last_response.body.must_match /&quot;&lt;h1&gt;omg&lt;&#x2F;h1&gt;&quot;/
202
+ last_response.body.must_match(/&quot;&lt;h1&gt;omg&lt;&#x2F;h1&gt;&quot;/)
190
203
  end
191
204
 
192
205
  it 'can escape error message' do
193
- last_response.body.must_match /ArgumentError: &lt;p&gt;wow&lt;&#x2F;p&gt;/
206
+ last_response.body.must_match(/ArgumentError: &lt;p&gt;wow&lt;&#x2F;p&gt;/)
194
207
  end
195
208
  end
196
209
 
@@ -202,7 +215,7 @@ module Sidekiq
202
215
 
203
216
  it 'should be successful' do
204
217
  last_response.status.must_equal 200
205
- last_response.body.wont_match /No failed jobs found/
218
+ last_response.body.wont_match(/No failed jobs found/)
206
219
  end
207
220
  end
208
221
 
@@ -214,7 +227,7 @@ module Sidekiq
214
227
 
215
228
  it 'should be successful' do
216
229
  last_response.status.must_equal 200
217
- last_response.body.wont_match /No failed jobs found/
230
+ last_response.body.wont_match(/No failed jobs found/)
218
231
  end
219
232
  end
220
233
  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: 0.4.5
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Silveira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2017-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.16.0
19
+ version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 2.16.0
26
+ version: 4.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -98,6 +112,8 @@ files:
98
112
  - lib/sidekiq/failures.rb
99
113
  - lib/sidekiq/failures/failure_set.rb
100
114
  - lib/sidekiq/failures/locales/en.yml
115
+ - lib/sidekiq/failures/locales/ja.yml
116
+ - lib/sidekiq/failures/locales/pt-BR.yml
101
117
  - lib/sidekiq/failures/middleware.rb
102
118
  - lib/sidekiq/failures/sorted_entry.rb
103
119
  - lib/sidekiq/failures/version.rb
@@ -105,6 +121,7 @@ files:
105
121
  - lib/sidekiq/failures/views/failures.erb
106
122
  - lib/sidekiq/failures/web_extension.rb
107
123
  - sidekiq-failures.gemspec
124
+ - test/failures_test.rb
108
125
  - test/middleware_test.rb
109
126
  - test/test_helper.rb
110
127
  - test/web_extension_test.rb
@@ -127,12 +144,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
144
  version: '0'
128
145
  requirements: []
129
146
  rubyforge_project:
130
- rubygems_version: 2.4.5
147
+ rubygems_version: 2.6.11
131
148
  signing_key:
132
149
  specification_version: 4
133
150
  summary: Keeps track of Sidekiq failed jobs and adds a tab to the Web UI to let you
134
151
  browse them. Makes use of Sidekiq's custom tabs and middleware chain.
135
152
  test_files:
153
+ - test/failures_test.rb
136
154
  - test/middleware_test.rb
137
155
  - test/test_helper.rb
138
156
  - test/web_extension_test.rb