resque 1.23.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/HISTORY.md +271 -0
  3. data/README.markdown +454 -484
  4. data/Rakefile +4 -17
  5. data/bin/resque-web +10 -22
  6. data/lib/resque/data_store.rb +335 -0
  7. data/lib/resque/errors.rb +15 -1
  8. data/lib/resque/failure/airbrake.rb +32 -4
  9. data/lib/resque/failure/base.rb +16 -7
  10. data/lib/resque/failure/multiple.rb +26 -8
  11. data/lib/resque/failure/redis.rb +92 -15
  12. data/lib/resque/failure/redis_multi_queue.rb +104 -0
  13. data/lib/resque/failure.rb +62 -32
  14. data/lib/resque/helpers.rb +11 -57
  15. data/lib/resque/job.rb +79 -12
  16. data/lib/resque/log_formatters/quiet_formatter.rb +7 -0
  17. data/lib/resque/log_formatters/verbose_formatter.rb +7 -0
  18. data/lib/resque/log_formatters/very_verbose_formatter.rb +8 -0
  19. data/lib/resque/logging.rb +18 -0
  20. data/lib/resque/plugin.rb +22 -10
  21. data/lib/resque/railtie.rb +10 -0
  22. data/lib/resque/server/public/jquery-3.6.0.min.js +2 -0
  23. data/lib/resque/server/public/jquery.relatize_date.js +4 -4
  24. data/lib/resque/server/public/main.js +3 -0
  25. data/lib/resque/server/public/ranger.js +16 -8
  26. data/lib/resque/server/public/style.css +13 -8
  27. data/lib/resque/server/views/error.erb +1 -1
  28. data/lib/resque/server/views/failed.erb +27 -59
  29. data/lib/resque/server/views/failed_job.erb +50 -0
  30. data/lib/resque/server/views/failed_queues_overview.erb +24 -0
  31. data/lib/resque/server/views/job_class.erb +8 -0
  32. data/lib/resque/server/views/key_sets.erb +2 -4
  33. data/lib/resque/server/views/key_string.erb +1 -1
  34. data/lib/resque/server/views/layout.erb +7 -6
  35. data/lib/resque/server/views/next_more.erb +22 -10
  36. data/lib/resque/server/views/processing.erb +2 -0
  37. data/lib/resque/server/views/queues.erb +22 -13
  38. data/lib/resque/server/views/stats.erb +5 -5
  39. data/lib/resque/server/views/workers.erb +4 -4
  40. data/lib/resque/server/views/working.erb +10 -11
  41. data/lib/resque/server.rb +51 -108
  42. data/lib/resque/server_helper.rb +185 -0
  43. data/lib/resque/stat.rb +19 -7
  44. data/lib/resque/tasks.rb +26 -25
  45. data/lib/resque/thread_signal.rb +24 -0
  46. data/lib/resque/vendor/utf8_util.rb +2 -8
  47. data/lib/resque/version.rb +1 -1
  48. data/lib/resque/web_runner.rb +374 -0
  49. data/lib/resque/worker.rb +487 -163
  50. data/lib/resque.rb +332 -52
  51. data/lib/tasks/redis.rake +11 -11
  52. metadata +169 -149
  53. data/lib/resque/failure/hoptoad.rb +0 -33
  54. data/lib/resque/failure/thoughtbot.rb +0 -33
  55. data/lib/resque/server/public/jquery-1.3.2.min.js +0 -19
  56. data/lib/resque/server/test_helper.rb +0 -19
  57. data/lib/resque/vendor/utf8_util/utf8_util_18.rb +0 -91
  58. data/lib/resque/vendor/utf8_util/utf8_util_19.rb +0 -5
  59. data/test/airbrake_test.rb +0 -27
  60. data/test/hoptoad_test.rb +0 -26
  61. data/test/job_hooks_test.rb +0 -464
  62. data/test/job_plugins_test.rb +0 -230
  63. data/test/plugin_test.rb +0 -116
  64. data/test/redis-test-cluster.conf +0 -115
  65. data/test/redis-test.conf +0 -115
  66. data/test/resque-web_test.rb +0 -59
  67. data/test/resque_failure_redis_test.rb +0 -19
  68. data/test/resque_test.rb +0 -278
  69. data/test/test_helper.rb +0 -178
  70. data/test/worker_test.rb +0 -657
@@ -1,230 +0,0 @@
1
- require 'test_helper'
2
-
3
- context "Multiple plugins with multiple hooks" do
4
- include PerformJob
5
-
6
- module Plugin1
7
- def before_perform_record_history1(history)
8
- history << :before1
9
- end
10
- def after_perform_record_history1(history)
11
- history << :after1
12
- end
13
- end
14
-
15
- module Plugin2
16
- def before_perform_record_history2(history)
17
- history << :before2
18
- end
19
- def after_perform_record_history2(history)
20
- history << :after2
21
- end
22
- end
23
-
24
- class ::ManyBeforesJob
25
- extend Plugin1
26
- extend Plugin2
27
- def self.perform(history)
28
- history << :perform
29
- end
30
- end
31
-
32
- test "hooks of each type are executed in alphabetical order" do
33
- result = perform_job(ManyBeforesJob, history=[])
34
- assert_equal true, result, "perform returned true"
35
- assert_equal [:before1, :before2, :perform, :after1, :after2], history
36
- end
37
- end
38
-
39
- context "Resque::Plugin ordering before_perform" do
40
- include PerformJob
41
-
42
- module BeforePerformPlugin
43
- def before_perform1(history)
44
- history << :before_perform1
45
- end
46
- end
47
-
48
- class ::JobPluginsTestBeforePerformJob
49
- extend BeforePerformPlugin
50
- def self.perform(history)
51
- history << :perform
52
- end
53
- def self.before_perform(history)
54
- history << :before_perform
55
- end
56
- end
57
-
58
- test "before_perform hooks are executed in order" do
59
- result = perform_job(JobPluginsTestBeforePerformJob, history=[])
60
- assert_equal true, result, "perform returned true"
61
- assert_equal [:before_perform, :before_perform1, :perform], history
62
- end
63
- end
64
-
65
- context "Resque::Plugin ordering after_perform" do
66
- include PerformJob
67
-
68
- module AfterPerformPlugin
69
- def after_perform_record_history(history)
70
- history << :after_perform1
71
- end
72
- end
73
-
74
- class ::JobPluginsTestAfterPerformJob
75
- extend AfterPerformPlugin
76
- def self.perform(history)
77
- history << :perform
78
- end
79
- def self.after_perform(history)
80
- history << :after_perform
81
- end
82
- end
83
-
84
- test "after_perform hooks are executed in order" do
85
- result = perform_job(JobPluginsTestAfterPerformJob, history=[])
86
- assert_equal true, result, "perform returned true"
87
- assert_equal [:perform, :after_perform, :after_perform1], history
88
- end
89
- end
90
-
91
- context "Resque::Plugin ordering around_perform" do
92
- include PerformJob
93
-
94
- module AroundPerformPlugin1
95
- def around_perform1(history)
96
- history << :around_perform_plugin1
97
- yield
98
- end
99
- end
100
-
101
- class ::AroundPerformJustPerformsJob
102
- extend AroundPerformPlugin1
103
- def self.perform(history)
104
- history << :perform
105
- end
106
- end
107
-
108
- test "around_perform hooks are executed before the job" do
109
- result = perform_job(AroundPerformJustPerformsJob, history=[])
110
- assert_equal true, result, "perform returned true"
111
- assert_equal [:around_perform_plugin1, :perform], history
112
- end
113
-
114
- class ::JobPluginsTestAroundPerformJob
115
- extend AroundPerformPlugin1
116
- def self.perform(history)
117
- history << :perform
118
- end
119
- def self.around_perform(history)
120
- history << :around_perform
121
- yield
122
- end
123
- end
124
-
125
- test "around_perform hooks are executed in order" do
126
- result = perform_job(JobPluginsTestAroundPerformJob, history=[])
127
- assert_equal true, result, "perform returned true"
128
- assert_equal [:around_perform, :around_perform_plugin1, :perform], history
129
- end
130
-
131
- module AroundPerformPlugin2
132
- def around_perform2(history)
133
- history << :around_perform_plugin2
134
- yield
135
- end
136
- end
137
-
138
- class ::AroundPerformJob2
139
- extend AroundPerformPlugin1
140
- extend AroundPerformPlugin2
141
- def self.perform(history)
142
- history << :perform
143
- end
144
- def self.around_perform(history)
145
- history << :around_perform
146
- yield
147
- end
148
- end
149
-
150
- test "many around_perform are executed in order" do
151
- result = perform_job(AroundPerformJob2, history=[])
152
- assert_equal true, result, "perform returned true"
153
- assert_equal [:around_perform, :around_perform_plugin1, :around_perform_plugin2, :perform], history
154
- end
155
-
156
- module AroundPerformDoesNotYield
157
- def around_perform0(history)
158
- history << :around_perform0
159
- end
160
- end
161
-
162
- class ::AroundPerformJob3
163
- extend AroundPerformPlugin1
164
- extend AroundPerformPlugin2
165
- extend AroundPerformDoesNotYield
166
- def self.perform(history)
167
- history << :perform
168
- end
169
- def self.around_perform(history)
170
- history << :around_perform
171
- yield
172
- end
173
- end
174
-
175
- test "the job is aborted if an around_perform hook does not yield" do
176
- result = perform_job(AroundPerformJob3, history=[])
177
- assert_equal false, result, "perform returned false"
178
- assert_equal [:around_perform, :around_perform0], history
179
- end
180
-
181
- module AroundPerformGetsJobResult
182
- @@result = nil
183
- def last_job_result
184
- @@result
185
- end
186
-
187
- def around_perform_gets_job_result(*args)
188
- @@result = yield
189
- end
190
- end
191
-
192
- class ::AroundPerformJobWithReturnValue < GoodJob
193
- extend AroundPerformGetsJobResult
194
- end
195
-
196
- test "the job is aborted if an around_perform hook does not yield" do
197
- result = perform_job(AroundPerformJobWithReturnValue, 'Bob')
198
- assert_equal true, result, "perform returned true"
199
- assert_equal 'Good job, Bob', AroundPerformJobWithReturnValue.last_job_result
200
- end
201
- end
202
-
203
- context "Resque::Plugin ordering on_failure" do
204
- include PerformJob
205
-
206
- module OnFailurePlugin
207
- def on_failure1(exception, history)
208
- history << "#{exception.message} plugin"
209
- end
210
- end
211
-
212
- class ::FailureJob
213
- extend OnFailurePlugin
214
- def self.perform(history)
215
- history << :perform
216
- raise StandardError, "oh no"
217
- end
218
- def self.on_failure(exception, history)
219
- history << exception.message
220
- end
221
- end
222
-
223
- test "on_failure hooks are executed in order" do
224
- history = []
225
- assert_raises StandardError do
226
- perform_job(FailureJob, history)
227
- end
228
- assert_equal [:perform, "oh no", "oh no plugin"], history
229
- end
230
- end
data/test/plugin_test.rb DELETED
@@ -1,116 +0,0 @@
1
- require 'test_helper'
2
-
3
- context "Resque::Plugin finding hooks" do
4
- module SimplePlugin
5
- extend self
6
- def before_perform1; end
7
- def before_perform; end
8
- def before_perform2; end
9
- def after_perform1; end
10
- def after_perform; end
11
- def after_perform2; end
12
- def perform; end
13
- def around_perform1; end
14
- def around_perform; end
15
- def around_perform2; end
16
- def on_failure1; end
17
- def on_failure; end
18
- def on_failure2; end
19
- end
20
-
21
- test "before_perform hooks are found and sorted" do
22
- assert_equal ["before_perform", "before_perform1", "before_perform2"], Resque::Plugin.before_hooks(SimplePlugin).map {|m| m.to_s}
23
- end
24
-
25
- test "after_perform hooks are found and sorted" do
26
- assert_equal ["after_perform", "after_perform1", "after_perform2"], Resque::Plugin.after_hooks(SimplePlugin).map {|m| m.to_s}
27
- end
28
-
29
- test "around_perform hooks are found and sorted" do
30
- assert_equal ["around_perform", "around_perform1", "around_perform2"], Resque::Plugin.around_hooks(SimplePlugin).map {|m| m.to_s}
31
- end
32
-
33
- test "on_failure hooks are found and sorted" do
34
- assert_equal ["on_failure", "on_failure1", "on_failure2"], Resque::Plugin.failure_hooks(SimplePlugin).map {|m| m.to_s}
35
- end
36
- end
37
-
38
- context "Resque::Plugin linting" do
39
- module ::BadBefore
40
- def self.before_perform; end
41
- end
42
- module ::BadAfter
43
- def self.after_perform; end
44
- end
45
- module ::BadAround
46
- def self.around_perform; end
47
- end
48
- module ::BadFailure
49
- def self.on_failure; end
50
- end
51
-
52
- test "before_perform must be namespaced" do
53
- begin
54
- Resque::Plugin.lint(BadBefore)
55
- assert false, "should have failed"
56
- rescue Resque::Plugin::LintError => e
57
- assert_equal "BadBefore.before_perform is not namespaced", e.message
58
- end
59
- end
60
-
61
- test "after_perform must be namespaced" do
62
- begin
63
- Resque::Plugin.lint(BadAfter)
64
- assert false, "should have failed"
65
- rescue Resque::Plugin::LintError => e
66
- assert_equal "BadAfter.after_perform is not namespaced", e.message
67
- end
68
- end
69
-
70
- test "around_perform must be namespaced" do
71
- begin
72
- Resque::Plugin.lint(BadAround)
73
- assert false, "should have failed"
74
- rescue Resque::Plugin::LintError => e
75
- assert_equal "BadAround.around_perform is not namespaced", e.message
76
- end
77
- end
78
-
79
- test "on_failure must be namespaced" do
80
- begin
81
- Resque::Plugin.lint(BadFailure)
82
- assert false, "should have failed"
83
- rescue Resque::Plugin::LintError => e
84
- assert_equal "BadFailure.on_failure is not namespaced", e.message
85
- end
86
- end
87
-
88
- module GoodBefore
89
- def self.before_perform1; end
90
- end
91
- module GoodAfter
92
- def self.after_perform1; end
93
- end
94
- module GoodAround
95
- def self.around_perform1; end
96
- end
97
- module GoodFailure
98
- def self.on_failure1; end
99
- end
100
-
101
- test "before_perform1 is an ok name" do
102
- Resque::Plugin.lint(GoodBefore)
103
- end
104
-
105
- test "after_perform1 is an ok name" do
106
- Resque::Plugin.lint(GoodAfter)
107
- end
108
-
109
- test "around_perform1 is an ok name" do
110
- Resque::Plugin.lint(GoodAround)
111
- end
112
-
113
- test "on_failure1 is an ok name" do
114
- Resque::Plugin.lint(GoodFailure)
115
- end
116
- end
@@ -1,115 +0,0 @@
1
- # Redis configuration file example
2
-
3
- # By default Redis does not run as a daemon. Use 'yes' if you need it.
4
- # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
5
- daemonize yes
6
-
7
- # When run as a daemon, Redis write a pid file in /var/run/redis.pid by default.
8
- # You can specify a custom pid file location here.
9
- pidfile ./test/redis-test-cluster.pid
10
-
11
- # Accept connections on the specified port, default is 6379
12
- port 9737
13
-
14
- # If you want you can bind a single interface, if the bind option is not
15
- # specified all the interfaces will listen for connections.
16
- #
17
- # bind 127.0.0.1
18
-
19
- # Close the connection after a client is idle for N seconds (0 to disable)
20
- timeout 300
21
-
22
- # Save the DB on disk:
23
- #
24
- # save <seconds> <changes>
25
- #
26
- # Will save the DB if both the given number of seconds and the given
27
- # number of write operations against the DB occurred.
28
- #
29
- # In the example below the behaviour will be to save:
30
- # after 900 sec (15 min) if at least 1 key changed
31
- # after 300 sec (5 min) if at least 10 keys changed
32
- # after 60 sec if at least 10000 keys changed
33
- save 900 1
34
- save 300 10
35
- save 60 10000
36
-
37
- # The filename where to dump the DB
38
- dbfilename dump-cluster.rdb
39
-
40
- # For default save/load DB in/from the working directory
41
- # Note that you must specify a directory not a file name.
42
- dir ./test/
43
-
44
- # Set server verbosity to 'debug'
45
- # it can be one of:
46
- # debug (a lot of information, useful for development/testing)
47
- # notice (moderately verbose, what you want in production probably)
48
- # warning (only very important / critical messages are logged)
49
- loglevel debug
50
-
51
- # Specify the log file name. Also 'stdout' can be used to force
52
- # the demon to log on the standard output. Note that if you use standard
53
- # output for logging but daemonize, logs will be sent to /dev/null
54
- logfile stdout
55
-
56
- # Set the number of databases. The default database is DB 0, you can select
57
- # a different one on a per-connection basis using SELECT <dbid> where
58
- # dbid is a number between 0 and 'databases'-1
59
- databases 16
60
-
61
- ################################# REPLICATION #################################
62
-
63
- # Master-Slave replication. Use slaveof to make a Redis instance a copy of
64
- # another Redis server. Note that the configuration is local to the slave
65
- # so for example it is possible to configure the slave to save the DB with a
66
- # different interval, or to listen to another port, and so on.
67
-
68
- # slaveof <masterip> <masterport>
69
-
70
- ################################## SECURITY ###################################
71
-
72
- # Require clients to issue AUTH <PASSWORD> before processing any other
73
- # commands. This might be useful in environments in which you do not trust
74
- # others with access to the host running redis-server.
75
- #
76
- # This should stay commented out for backward compatibility and because most
77
- # people do not need auth (e.g. they run their own servers).
78
-
79
- # requirepass foobared
80
-
81
- ################################### LIMITS ####################################
82
-
83
- # Set the max number of connected clients at the same time. By default there
84
- # is no limit, and it's up to the number of file descriptors the Redis process
85
- # is able to open. The special value '0' means no limts.
86
- # Once the limit is reached Redis will close all the new connections sending
87
- # an error 'max number of clients reached'.
88
-
89
- # maxclients 128
90
-
91
- # Don't use more memory than the specified amount of bytes.
92
- # When the memory limit is reached Redis will try to remove keys with an
93
- # EXPIRE set. It will try to start freeing keys that are going to expire
94
- # in little time and preserve keys with a longer time to live.
95
- # Redis will also try to remove objects from free lists if possible.
96
- #
97
- # If all this fails, Redis will start to reply with errors to commands
98
- # that will use more memory, like SET, LPUSH, and so on, and will continue
99
- # to reply to most read-only commands like GET.
100
- #
101
- # WARNING: maxmemory can be a good idea mainly if you want to use Redis as a
102
- # 'state' server or cache, not as a real DB. When Redis is used as a real
103
- # database the memory usage will grow over the weeks, it will be obvious if
104
- # it is going to use too much memory in the long run, and you'll have the time
105
- # to upgrade. With maxmemory after the limit is reached you'll start to get
106
- # errors for write operations, and this may even lead to DB inconsistency.
107
-
108
- # maxmemory <bytes>
109
-
110
- ############################### ADVANCED CONFIG ###############################
111
-
112
- # Glue small output buffers together in order to send small replies in a
113
- # single TCP packet. Uses a bit more CPU but most of the times it is a win
114
- # in terms of number of queries per second. Use 'yes' if unsure.
115
- glueoutputbuf yes
data/test/redis-test.conf DELETED
@@ -1,115 +0,0 @@
1
- # Redis configuration file example
2
-
3
- # By default Redis does not run as a daemon. Use 'yes' if you need it.
4
- # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
5
- daemonize yes
6
-
7
- # When run as a daemon, Redis write a pid file in /var/run/redis.pid by default.
8
- # You can specify a custom pid file location here.
9
- pidfile ./test/redis-test.pid
10
-
11
- # Accept connections on the specified port, default is 6379
12
- port 9736
13
-
14
- # If you want you can bind a single interface, if the bind option is not
15
- # specified all the interfaces will listen for connections.
16
- #
17
- # bind 127.0.0.1
18
-
19
- # Close the connection after a client is idle for N seconds (0 to disable)
20
- timeout 300
21
-
22
- # Save the DB on disk:
23
- #
24
- # save <seconds> <changes>
25
- #
26
- # Will save the DB if both the given number of seconds and the given
27
- # number of write operations against the DB occurred.
28
- #
29
- # In the example below the behaviour will be to save:
30
- # after 900 sec (15 min) if at least 1 key changed
31
- # after 300 sec (5 min) if at least 10 keys changed
32
- # after 60 sec if at least 10000 keys changed
33
- save 900 1
34
- save 300 10
35
- save 60 10000
36
-
37
- # The filename where to dump the DB
38
- dbfilename dump.rdb
39
-
40
- # For default save/load DB in/from the working directory
41
- # Note that you must specify a directory not a file name.
42
- dir ./test/
43
-
44
- # Set server verbosity to 'debug'
45
- # it can be one of:
46
- # debug (a lot of information, useful for development/testing)
47
- # notice (moderately verbose, what you want in production probably)
48
- # warning (only very important / critical messages are logged)
49
- loglevel debug
50
-
51
- # Specify the log file name. Also 'stdout' can be used to force
52
- # the demon to log on the standard output. Note that if you use standard
53
- # output for logging but daemonize, logs will be sent to /dev/null
54
- logfile stdout
55
-
56
- # Set the number of databases. The default database is DB 0, you can select
57
- # a different one on a per-connection basis using SELECT <dbid> where
58
- # dbid is a number between 0 and 'databases'-1
59
- databases 16
60
-
61
- ################################# REPLICATION #################################
62
-
63
- # Master-Slave replication. Use slaveof to make a Redis instance a copy of
64
- # another Redis server. Note that the configuration is local to the slave
65
- # so for example it is possible to configure the slave to save the DB with a
66
- # different interval, or to listen to another port, and so on.
67
-
68
- # slaveof <masterip> <masterport>
69
-
70
- ################################## SECURITY ###################################
71
-
72
- # Require clients to issue AUTH <PASSWORD> before processing any other
73
- # commands. This might be useful in environments in which you do not trust
74
- # others with access to the host running redis-server.
75
- #
76
- # This should stay commented out for backward compatibility and because most
77
- # people do not need auth (e.g. they run their own servers).
78
-
79
- # requirepass foobared
80
-
81
- ################################### LIMITS ####################################
82
-
83
- # Set the max number of connected clients at the same time. By default there
84
- # is no limit, and it's up to the number of file descriptors the Redis process
85
- # is able to open. The special value '0' means no limts.
86
- # Once the limit is reached Redis will close all the new connections sending
87
- # an error 'max number of clients reached'.
88
-
89
- # maxclients 128
90
-
91
- # Don't use more memory than the specified amount of bytes.
92
- # When the memory limit is reached Redis will try to remove keys with an
93
- # EXPIRE set. It will try to start freeing keys that are going to expire
94
- # in little time and preserve keys with a longer time to live.
95
- # Redis will also try to remove objects from free lists if possible.
96
- #
97
- # If all this fails, Redis will start to reply with errors to commands
98
- # that will use more memory, like SET, LPUSH, and so on, and will continue
99
- # to reply to most read-only commands like GET.
100
- #
101
- # WARNING: maxmemory can be a good idea mainly if you want to use Redis as a
102
- # 'state' server or cache, not as a real DB. When Redis is used as a real
103
- # database the memory usage will grow over the weeks, it will be obvious if
104
- # it is going to use too much memory in the long run, and you'll have the time
105
- # to upgrade. With maxmemory after the limit is reached you'll start to get
106
- # errors for write operations, and this may even lead to DB inconsistency.
107
-
108
- # maxmemory <bytes>
109
-
110
- ############################### ADVANCED CONFIG ###############################
111
-
112
- # Glue small output buffers together in order to send small replies in a
113
- # single TCP packet. Uses a bit more CPU but most of the times it is a win
114
- # in terms of number of queries per second. Use 'yes' if unsure.
115
- glueoutputbuf yes
@@ -1,59 +0,0 @@
1
- require 'test_helper'
2
- require 'resque/server/test_helper'
3
-
4
- # Root path test
5
- context "on GET to /" do
6
- setup { get "/" }
7
-
8
- test "redirect to overview" do
9
- follow_redirect!
10
- end
11
- end
12
-
13
- # Global overview
14
- context "on GET to /overview" do
15
- setup { get "/overview" }
16
-
17
- test "should at least display 'queues'" do
18
- assert last_response.body.include?('Queues')
19
- end
20
- end
21
-
22
- # Working jobs
23
- context "on GET to /working" do
24
- setup { get "/working" }
25
-
26
- should_respond_with_success
27
- end
28
-
29
- # Failed
30
- context "on GET to /failed" do
31
- setup { get "/failed" }
32
-
33
- should_respond_with_success
34
- end
35
-
36
- # Stats
37
- context "on GET to /stats/resque" do
38
- setup { get "/stats/resque" }
39
-
40
- should_respond_with_success
41
- end
42
-
43
- context "on GET to /stats/redis" do
44
- setup { get "/stats/redis" }
45
-
46
- should_respond_with_success
47
- end
48
-
49
- context "on GET to /stats/resque" do
50
- setup { get "/stats/keys" }
51
-
52
- should_respond_with_success
53
- end
54
-
55
- context "also works with slash at the end" do
56
- setup { get "/working/" }
57
-
58
- should_respond_with_success
59
- end
@@ -1,19 +0,0 @@
1
- require 'test_helper'
2
- require 'resque/failure/redis'
3
-
4
- context "Resque::Failure::Redis" do
5
- setup do
6
- @bad_string = [39, 250, 141, 168, 138, 191, 52, 211, 159, 86, 93, 95, 39].map { |c| c.chr }.join
7
- exception = StandardError.exception(@bad_string)
8
- worker = Resque::Worker.new(:test)
9
- queue = "queue"
10
- payload = { "class" => Object, "args" => 3 }
11
- @redis_backend = Resque::Failure::Redis.new(exception, worker, queue, payload)
12
- end
13
-
14
- test 'cleans up bad strings before saving the failure, in order to prevent errors on the resque UI' do
15
- # test assumption: the bad string should not be able to round trip though JSON
16
- @redis_backend.save
17
- Resque::Failure::Redis.all # should not raise an error
18
- end
19
- end