iron_mq 4.0.5 → 4.1.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: 59de953d559a2e493b72d7d9f5d588fb45b09522
4
- data.tar.gz: ff331240b424418b610a83bb37f4091d5ac6f8af
3
+ metadata.gz: 1f1f8bd2435758c3f0e785860745e53693f420dd
4
+ data.tar.gz: 8c528651911fbab189d39f2517a6916ccff76455
5
5
  SHA512:
6
- metadata.gz: 24378f0dcf15c8f5c54759dfe6bac0e556ffa05905e9fb26597c28bfd63b23b3146a5a8dff5285cf9b0668e6b9036ac023b9df2ebd6caa795f2954fc9136aad6
7
- data.tar.gz: 3ffaa342f10a49f5cd638b75e7440b4d2d36cc709f186866740cbd1013aa57e672f1e4db1302dcc38a05a5c116e82a633c4a72a055b5ee4e1f92d7dd2e506bd2
6
+ metadata.gz: dff00f9dc21895c394d2b0b03fd37e4cc3994d80b980ac9ac1e56c4169c07b540f42df0a07ae02eb3015261695de0bfeb8bd55655ec2024c092d033122254493
7
+ data.tar.gz: f55c54ab596adc06964a1209b7ed5bef4c09c4ce4013dcedeec0a6d234489c8abbd28834acfd7320d06f50704ae7fd232b4b7990ac35d064c77337e109efc762
@@ -9,33 +9,34 @@ GEM
9
9
  specs:
10
10
  beanstalk-client (1.1.1)
11
11
  concur (2.1.1)
12
- ethon (0.6.1)
12
+ ethon (0.6.2)
13
13
  ffi (>= 1.3.0)
14
14
  mime-types (~> 1.18)
15
- ffi (1.9.0)
15
+ ffi (1.9.3)
16
16
  go (1.1.0)
17
17
  concur
18
- iron_core (1.0.1)
19
- rest (>= 2.2.0)
20
- iron_worker_ng (1.0.2)
21
- bundler (>= 1.2.0)
18
+ iron_core (1.0.3)
19
+ rest (>= 2.6.4)
20
+ iron_worker_ng (1.0.4)
21
+ bundler
22
22
  iron_core (>= 1.0.0)
23
23
  rubyzip (= 0.9.9)
24
- mime-types (1.25)
25
- minitest (5.0.8)
24
+ mime-types (1.25.1)
25
+ minitest (5.2.1)
26
26
  net-http-persistent (2.9)
27
+ netrc (0.7.7)
27
28
  quicky (0.4.0)
28
- rake (10.1.0)
29
- rest (2.6.3)
29
+ rake (10.1.1)
30
+ rest (2.7.0)
30
31
  net-http-persistent
31
- rest-client (>= 0.3.0)
32
- rest-client (1.6.7)
33
- mime-types (>= 1.16)
32
+ rest_client (>= 1.7.1)
33
+ rest_client (1.7.2)
34
+ netrc (~> 0.7.7)
34
35
  rubyzip (0.9.9)
35
36
  test-unit (2.5.5)
36
- typhoeus (0.6.5)
37
- ethon (~> 0.6.1)
38
- uber_config (1.0.5)
37
+ typhoeus (0.6.7)
38
+ ethon (~> 0.6.2)
39
+ uber_config (1.1.0)
39
40
 
40
41
  PLATFORMS
41
42
  ruby
@@ -11,21 +11,25 @@ module IronMQ
11
11
  end
12
12
 
13
13
  def id
14
- @raw["id"]
14
+ @raw['id']
15
15
  end
16
16
 
17
17
  # alert type
18
18
  def type
19
- @raw["type"]
19
+ @raw['type']
20
20
  end
21
21
 
22
22
  # target queue
23
23
  def queue
24
- @raw["queue"]
24
+ @raw['queue']
25
25
  end
26
26
 
27
27
  def trigger
28
- @raw["trigger"]
28
+ @raw['trigger']
29
+ end
30
+
31
+ def direction
32
+ @raw['direction']
29
33
  end
30
34
 
31
35
  # `options` was kept for backward compatibility
@@ -33,9 +37,9 @@ module IronMQ
33
37
  @message.call_api_and_parse_response(:delete, path)
34
38
  rescue Rest::HttpError => ex
35
39
  if ex.code == 404
36
- IronCore::Logger.info("IronMQ", "Delete got 404, safe to ignore.")
40
+ IronCore::Logger.info('IronMQ', 'Delete got 404, safe to ignore.')
37
41
  # return ResponseBase as normal
38
- ResponseBase.new({"msg" => "Deleted"}, 404)
42
+ ResponseBase.new({'msg' => 'Deleted'}, 404)
39
43
  else
40
44
  raise ex
41
45
  end
@@ -8,7 +8,6 @@ module IronMQ
8
8
  def initialize(client, queue_name)
9
9
  @client = client
10
10
  @name = queue_name
11
-
12
11
  end
13
12
 
14
13
  def info
@@ -17,9 +16,8 @@ module IronMQ
17
16
 
18
17
  # this is only run once if it hasn't been called before unless force is true, then it will force reload.
19
18
  def load
20
- if @raw.nil?
21
- reload
22
- end
19
+ reload if @raw.nil?
20
+
23
21
  @raw
24
22
  end
25
23
 
@@ -243,11 +241,7 @@ module IronMQ
243
241
  private
244
242
 
245
243
  def to_alerts(alert_array)
246
- r = []
247
- alert_array.each do |a|
248
- r << Alert.new(self, a)
249
- end
250
- r
244
+ alert_array.each_with_object([]) { |a, res| res << Alert.new(self, a) }
251
245
  end
252
246
 
253
247
  def path(ext_path)
@@ -10,6 +10,14 @@ module IronMQ
10
10
  @options = options
11
11
  end
12
12
 
13
+ def url
14
+ @raw['url']
15
+ end
16
+
17
+ def headers
18
+ @raw['headers']
19
+ end
20
+
13
21
  # `options` was kept for backward compatibility
14
22
  def delete(options = {})
15
23
  @message.call_api_and_parse_response(:delete, path)
@@ -1,3 +1,4 @@
1
1
  module IronMQ
2
- VERSION = "4.0.5"
2
+ VERSION = "4.1.0"
3
3
  end
4
+
@@ -13,130 +13,217 @@ class TestAlerts < TestBase
13
13
  def test_size_alerts
14
14
  return if @skip
15
15
 
16
- # Add a normal size alert
17
- # Post x messages
18
- # check to ensure alert was triggered
16
+ type = 'size'
17
+ trigger = 10
18
+ # Test size alets, direction is ascending
19
+ queue, alert_queue = clear_queue_add_alert(type, trigger, 'asc')
19
20
 
20
- x = rand(1000)
21
- qname = "alert-queue-#{x}"
22
- clear_queue(qname)
23
- queue = @client.queue(qname)
24
- puts "queue: #{queue}"
25
- trigger_value = 10
26
- # todo: should :queue be called something else, like target_queue? or url and have to use ironmq:// url?
27
- target_queue_name = "alert-target-queue-#{x}"
28
- r = queue.add_alert({:type => "size", :trigger => trigger_value, :queue => target_queue_name})
29
- p r
21
+ # queue size will be trigger + 3
22
+ trigger_alert(queue, alert_queue, trigger, 3)
30
23
 
31
- alerts = queue.alerts
32
- p alerts
33
- assert_equal 1, alerts.size
34
- alert = alerts[0]
35
- assert_equal "size", alert.type
36
- assert_equal trigger_value, alert.trigger
37
- assert_equal target_queue_name, alert.queue
24
+ # must not trigger alert, queue size will be trigger + 13
25
+ post_messages(queue, 10)
26
+ assert_equal 1, get_queue_size(alert_queue)
38
27
 
39
- target_queue = @client.queue(target_queue_name)
40
- assert_equal 0, target_queue.size
28
+ # must not trigger alert, queue size will be trigger - 3
29
+ delete_messages(queue, 16)
30
+ assert_equal 1, get_queue_size(alert_queue)
41
31
 
42
- (trigger_value - 1).times do |i|
43
- puts "posting #{i}"
44
- queue.post("message #{i}")
45
- end
46
- sleep 0.5
47
- assert_equal 0, target_queue.size
48
- queue.post("message #{trigger_value}")
49
- sleep 0.5
50
- assert_equal trigger_value, queue.size
51
- assert_equal 1, target_queue.size
52
-
53
- # now let's get it down the reset point and trigger it again
54
- (trigger_value / 2).times do |i|
55
- m = queue.get
56
- m.delete
57
- end
58
- assert_equal trigger_value/2, queue.size
59
- assert_equal 1, target_queue.size
32
+ trigger_alert(queue, alert_queue, trigger)
60
33
 
61
- # once it's at half, it should reset so let's get it back up to trigger_value again
62
- (trigger_value / 2).times do |i|
63
- queue.post("second set: message #{i}")
64
- end
65
- sleep 0.5
66
- assert_equal trigger_value, queue.size
67
- assert_equal 2, target_queue.size
34
+ delete_queues(queue, alert_queue)
68
35
 
69
- queue.delete_queue
70
- target_queue.delete_queue
36
+ # Test size alerts, direction is descending
37
+ queue, alert_queue = clear_queue_add_alert(type, trigger, 'desc')
71
38
 
72
- end
39
+ # must not trigger descending alert
40
+ post_messages(queue, 15)
41
+ assert_equal 0, get_queue_size(alert_queue)
42
+
43
+ # will remove 5 msgs, queue size will be 10
44
+ trigger_alert(queue, alert_queue, trigger)
45
+
46
+ # must not trigger alert
47
+ post_messages(queue, 12)
48
+ assert_equal 1, get_queue_size(alert_queue)
49
+
50
+ trigger_alert(queue, alert_queue, trigger)
51
+
52
+ # must not trigger alert
53
+ delete_messages(queue, 8)
54
+ assert_equal 2, get_queue_size(alert_queue)
55
+
56
+ delete_queues(queue, alert_queue)
57
+
58
+ # Test size alerts, direction is "both"
59
+ queue, alert_queue = clear_queue_add_alert(type, trigger, 'both')
73
60
 
61
+ # trigger ascending alert
62
+ trigger_alert(queue, alert_queue, trigger)
63
+
64
+ # must not trigger alert
65
+ post_messages(queue, 8)
66
+ assert_equal 1, get_queue_size(alert_queue)
67
+
68
+ # trigger descending alert, queue size will be trigger - 3
69
+ trigger_alert(queue, alert_queue, trigger, 3)
70
+
71
+ # trigger ascending alert, queue size will be trigger + 3
72
+ trigger_alert(queue, alert_queue, trigger, 3)
73
+
74
+ delete_queues(queue, alert_queue)
75
+ end
74
76
 
75
77
  def test_progressive_alerts
76
78
  return if @skip
77
79
 
78
- # Add a normal size alert
79
- # Post x messages
80
- # check to ensure alert was triggered
80
+ type = 'progressive'
81
+ trigger = 10
82
+ # Test ascending progressive alert
83
+ queue, alert_queue = clear_queue_add_alert(type, trigger, 'asc')
84
+
85
+ # Trigger 3 alerts
86
+ (1..3).each { |n| trigger_alert(queue, alert_queue, n * trigger) }
87
+
88
+ # Must not trigger alerts
89
+ delete_messages(queue, 15)
90
+ assert_equal 3, get_queue_size(alert_queue)
91
+
92
+ trig = (get_queue_size(queue) / trigger.to_f).ceil * trigger
93
+ trigger_alert(queue, alert_queue, trig)
94
+
95
+ # must not trigger alert
96
+ delete_messages(queue, get_queue_size(queue) - 1)
97
+
98
+ delete_queues(queue, alert_queue)
99
+
100
+ # Test descending progressive alert
101
+ queue, alert_queue = clear_queue_add_alert(type, trigger, 'desc')
102
+
103
+ # must not trigger alert
104
+ post_messages(queue, 25)
105
+ assert_equal 0, get_queue_size(alert_queue)
106
+
107
+ # trigger descending alert twice
108
+ 2.downto(1) { |n| trigger_alert(queue, alert_queue, n * trigger) }
109
+
110
+ # must not trigger alert at size of 0
111
+ delete_messages(queue, 5)
112
+ assert_equal 2, get_queue_size(alert_queue)
113
+
114
+ # must not trigger alert
115
+ post_messages(queue, 15)
116
+ assert_equal 2, get_queue_size(alert_queue)
117
+
118
+ delete_queues(queue, alert_queue)
119
+
120
+ # Test "both" direction progressive alerts
121
+ queue, alert_queue = clear_queue_add_alert(type, trigger, 'both')
122
+
123
+ trigger_alert(queue, alert_queue, trigger, 2)
124
+ trigger_alert(queue, alert_queue, 2 * trigger) # queue size = 2 * trigger
125
+
126
+ # must not trigger descending alert
127
+ delete_messages(queue, trigger / 2)
128
+ assert_equal 2, get_queue_size(alert_queue)
129
+
130
+ # trigger descending alert, queue size will be trigger - 3
131
+ trigger_alert(queue, alert_queue, trigger, 3)
132
+
133
+ # trigger ascending alert, queue size will be trigger + 5
134
+ trigger_alert(queue, alert_queue, trigger, 5)
135
+
136
+ # must not trigger alerts below, queue size will be 2 * trigger - 1
137
+ post_messages(queue, trigger - 5 - 1)
138
+ assert_equal 4, get_queue_size(alert_queue)
139
+
140
+ # one message before trigger value
141
+ delete_messages(queue, trigger - 2)
142
+ assert_equal 4, get_queue_size(alert_queue)
143
+
144
+ delete_queues(queue, alert_queue)
145
+ end
146
+
147
+ def post_messages(queue, n)
148
+ queue.post(Array.new(n, { :body => 'message' }))
149
+ sleep 1
150
+ end
151
+
152
+ def delete_messages(queue, n)
153
+ msgs = queue.get(:n => n)
154
+ [msgs].flatten.each { |msg| msg.delete }
155
+ sleep 1
156
+ end
157
+
158
+ def delete_queues(*queues)
159
+ queues.each { |q| q.delete_queue }
160
+ end
161
+
162
+ def trigger_alert(queue, alert_queue, trigger, overhead = 0)
163
+ puts "trigger_alert(), called at #{caller[0]}"
164
+
165
+ qsize = get_queue_size(queue)
166
+ puts "Initial queue size is #{qsize}"
167
+ puts 'Alert is already triggered!' if qsize == trigger
168
+ aq_size = get_queue_size(alert_queue)
169
+
170
+ if qsize < trigger
171
+ nmsgs = trigger - qsize - 1
172
+ puts "Try to trigger ascending alert... post #{nmsgs} messages"
173
+ post_messages(queue, nmsgs)
174
+ else
175
+ nmsgs = qsize - trigger - 1
176
+ puts "Try to trigger descending alert... delete #{nmsgs} messages"
177
+ delete_messages(queue, nmsgs)
178
+ end
179
+ assert_equal aq_size, get_queue_size(alert_queue)
180
+
181
+ if qsize < trigger
182
+ puts "Post more #{1 + overhead} messages"
183
+ post_messages(queue, 1 + overhead)
184
+ else
185
+ puts "Delete more #{1 + overhead} messages"
186
+ delete_messages(queue, 1 + overhead)
187
+ end
188
+ assert_equal aq_size + 1, get_queue_size(alert_queue)
189
+ end
190
+
191
+ def clear_queue_add_alert(type, trigger, direction)
192
+ puts "clear_queue_add_alert(), called at #{caller[0]}"
193
+
194
+ qname = "#{type}-#{direction}-#{trigger}"
195
+ alert_qname = "#{qname}-alerts"
81
196
 
82
- x = rand(1000)
83
- qname = "alert-queue-#{x}"
84
197
  queue = @client.queue(qname)
85
- trigger_value = 10
86
- # todo: should :queue be called something else, like target_queue? or url and have to use ironmq:// url?
87
- target_queue_name = "alert-target-queue-#{x}"
88
- r = queue.add_alert({:type => "progressive", :trigger => trigger_value, :queue => target_queue_name})
89
- p r
198
+ alert_queue = @client.queue(alert_qname)
199
+ # delete instead of clearing to remove all alerts from queue
200
+ delete_queues(queue, alert_queue)
201
+ # todo: should :queue be called something else,
202
+ # like alert_queue? or url and have to use ironmq:// url?
203
+ r = queue.add_alert({ :type => type, :trigger => trigger,
204
+ :queue => alert_qname, :direction => direction })
205
+ #p r
90
206
 
91
207
  alerts = queue.alerts
208
+ #p alerts
209
+
92
210
  assert_equal 1, alerts.size
93
211
  alert = alerts[0]
94
- assert_equal "progressive", alert.type
95
- assert_equal trigger_value, alert.trigger
96
- assert_equal target_queue_name, alert.queue
97
-
98
- target_queue = @client.queue(target_queue_name)
99
- assert_equal 0, target_queue.size
100
-
101
- post_messages(queue, trigger_value)
102
- assert_equal trigger_value, queue.size
103
- assert_equal 1, target_queue.size
104
-
105
- # now let's do it again and see if it tiggers again
106
- post_messages(queue, trigger_value)
107
- assert_equal trigger_value * 2, queue.size
108
- assert_equal 2, target_queue.size
109
-
110
- # now let's do it once again and see if it triggers again
111
- post_messages(queue, trigger_value)
112
- assert_equal trigger_value * 3, queue.size
113
- assert_equal 3, target_queue.size
114
-
115
- # now let's get it down to the reset point and trigger it again
116
- (trigger_value).times do |i|
117
- m = queue.get
118
- m.delete
119
- end
120
- sleep 0.5
121
- assert_equal trigger_value*2, queue.size
122
- assert_equal 3, target_queue.size
123
-
124
- # once it's at half, it should reset so let's get it back up to trigger_value again
125
- post_messages(queue, trigger_value)
126
- assert_equal trigger_value*3, queue.size
127
- assert_equal 4, target_queue.size
128
-
129
- queue.delete_queue
130
- target_queue.delete_queue
212
+ #p alert
213
+ assert_equal type, alert.type
214
+ assert_equal trigger, alert.trigger
215
+ assert_equal alert_qname, alert.queue
216
+ assert_equal direction, alert.direction
131
217
 
218
+ [queue, @client.queue(alert_qname)]
132
219
  end
133
220
 
134
- def post_messages(queue, num)
135
- (num).times do |i|
136
- queue.post("message #{i}")
221
+ def get_queue_size(queue)
222
+ begin
223
+ queue.reload.size
224
+ rescue Rest::HttpError => ex
225
+ ex.message =~ /404/ ? 0 : raise(ex)
137
226
  end
138
- sleep 0.5
139
227
  end
140
-
141
228
 
142
229
  end
@@ -12,6 +12,50 @@ class TestPushQueues < TestBase
12
12
  key = "pushq-#{t}-#{i}-#{random}"
13
13
  end
14
14
 
15
+ def test_subscriber_add_remove
16
+ puts "test_subscriber_add_remove"
17
+ qname = "subscribers_add_remove_test"
18
+ s = "http://nowhere.com:8080/somepath"
19
+ s2 = "http://somewhere.com"
20
+ queue = @client.queue(qname)
21
+ subscribers = [{:url => s}]
22
+ res = queue.update_queue(:subscribers => subscribers)
23
+ LOG.debug queue.subscribers
24
+ assert_equal 1, queue.subscribers.size
25
+
26
+ queue.reload
27
+ assert_equal 1, queue.subscribers.size
28
+ p queue.subscribers[0].url
29
+ queue.remove_subscriber({:url => s})
30
+ queue.reload
31
+ assert_equal 0, queue.subscribers.size
32
+ p queue.subscribers
33
+
34
+ # add it back with add
35
+ queue.add_subscriber({:url => s})
36
+ queue.reload
37
+ assert_equal 1, queue.subscribers.size
38
+ p queue.subscribers[0].url
39
+ queue.remove_subscriber({:url => s})
40
+ queue.reload
41
+ assert_equal 0, queue.subscribers.size
42
+ p queue.subscribers
43
+
44
+ # add two, remove first
45
+ queue.add_subscriber({:url => s})
46
+ queue.add_subscriber({:url => s2})
47
+ queue.reload
48
+ assert_equal 2, queue.subscribers.size
49
+ p queue.subscribers[0].url
50
+ queue.remove_subscriber({:url => s})
51
+ queue.reload
52
+ assert_equal 1, queue.subscribers.size
53
+ p queue.subscribers[0].url
54
+ assert_equal s2, queue.subscribers[0].url
55
+
56
+ queue.delete_queue
57
+ end
58
+
15
59
 
16
60
  def test_queue_subscriptions
17
61
  puts "test_queue_subscriptions"
@@ -69,6 +113,7 @@ class TestPushQueues < TestBase
69
113
  url = "http://rest-test.iron.io/stored/#{key}"
70
114
  LOG.info "checking url #{url}"
71
115
  response = @rest.get(url)
116
+ p response.body
72
117
  parsed = JSON.parse(response.body)
73
118
  LOG.debug parsed['body']
74
119
  assert_equal msg, parsed['body']
@@ -78,7 +123,7 @@ class TestPushQueues < TestBase
78
123
  LOG.debug ex.code
79
124
  assert_equal 404, ex.code
80
125
  end
81
- end
126
+ end
82
127
  assert_not_equal tries, 0
83
128
  end
84
129
  elsif t == "unicast"
@@ -103,7 +148,7 @@ class TestPushQueues < TestBase
103
148
  end
104
149
  end
105
150
  break if found == 1
106
- end
151
+ end
107
152
  assert_not_equal tries, 0
108
153
  end
109
154
 
@@ -111,7 +156,7 @@ class TestPushQueues < TestBase
111
156
  while tries > 0
112
157
 
113
158
  # Need to wait > 60s here, because in case of retries on pusherd
114
- # side (due lost connection for example) there will be no response earlier
159
+ # side (due lost connection for example) there will be no response earlier
115
160
  # (default retries_delay is 60s).
116
161
  sleep 1
117
162
  tries -= 1
@@ -149,6 +194,60 @@ class TestPushQueues < TestBase
149
194
  end
150
195
  end
151
196
 
197
+ def test_headers
198
+ puts "test_headers"
199
+ qname = "push-headers"
200
+ subscribers = []
201
+
202
+ x = rand(1000)
203
+ key = "somemsg_#{x}"
204
+ subscribers << {:url => "http://rest-test.iron.io/code/200?store=#{key}",
205
+ :headers=>{"Content-Type"=>"application/json"}}
206
+
207
+ queue = @client.queue(qname)
208
+ queue.update_queue(:subscribers => subscribers,
209
+ :push_type => "multicast")
210
+
211
+ LOG.debug queue.subscribers
212
+ assert_equal subscribers.size, queue.subscribers.size
213
+ queue.reload.subscribers.each do |s|
214
+ p s.headers
215
+ assert_not_nil s.headers['Content-Type']
216
+ end
217
+
218
+ msg = "{\"hello\": #{x}}"
219
+ m = queue.post(msg)
220
+
221
+ LOG.info "Checking results..."
222
+ @rest = Rest::Client.new
223
+ found = 0
224
+ tries = MAX_TRIES
225
+ while tries > 0
226
+ tries -= 1
227
+ sleep 1
228
+ begin
229
+ url = "http://rest-test.iron.io/stored/#{key}"
230
+ LOG.info "checking url #{url}"
231
+ response = @rest.get(url)
232
+ p response.body
233
+ parsed = JSON.parse(response.body)
234
+ LOG.debug parsed['body']
235
+ assert_equal msg, parsed['body']
236
+ assert_not_nil parsed['headers']['Content-Type']
237
+ assert_equal 'application/json', parsed['headers']['Content-Type']
238
+ break
239
+ rescue Rest::HttpError => ex
240
+ LOG.debug ex.code
241
+ assert_equal 404, ex.code
242
+ end
243
+ assert_not_equal tries, 0
244
+ end
245
+
246
+ # delete queue after all tests on it were completed
247
+ resp = queue.delete_queue
248
+ assert_equal 200, resp.code, "API must respond with HTTP 200 status, but returned HTTP #{resp.code}"
249
+ end
250
+
152
251
 
153
252
  def test_failure
154
253
  @rest = Rest::Client.new
@@ -176,7 +275,7 @@ class TestPushQueues < TestBase
176
275
  msg = "hello #{x}"
177
276
  m = queue.post(msg)
178
277
  LOG.debug m
179
-
278
+
180
279
  tries = MAX_TRIES
181
280
  while tries > 0
182
281
  sleep 0.5
@@ -333,7 +432,7 @@ class TestPushQueues < TestBase
333
432
  subscribers = queue.messages.get(m.id).subscribers
334
433
  LOG.debug subscribers
335
434
  next unless num_subscribers == subscribers.size
336
-
435
+
337
436
  do_retry = false
338
437
  subscribers.each do |s|
339
438
  LOG.debug s
@@ -385,7 +484,7 @@ class TestPushQueues < TestBase
385
484
  end
386
485
 
387
486
 
388
- # tests when converting a push queue back to a pull queue
487
+ # tests when converting a push queue back to a pull queue
389
488
  def test_converting_types
390
489
  queue = @client.queue('converting_queue')
391
490
  subscribers = [{:url => "http://rest-test.iron.io/code/200"},
@@ -406,7 +505,7 @@ class TestPushQueues < TestBase
406
505
  assert_nil queue.push_type
407
506
 
408
507
  end
409
-
508
+
410
509
  def test_error_queues
411
510
  @rest = Rest::Client.new
412
511
  qname = "badrobot"
@@ -435,7 +534,7 @@ class TestPushQueues < TestBase
435
534
  orig_id = m.id
436
535
  puts "Msg id on post: #{orig_id}"
437
536
  LOG.debug m
438
-
537
+
439
538
  tries = MAX_TRIES
440
539
  while tries > 0
441
540
  puts 'sleeping for 5 to wait for retry'
@@ -468,7 +567,7 @@ class TestPushQueues < TestBase
468
567
  break
469
568
  end
470
569
  assert_not_equal tries, 0
471
-
570
+
472
571
  # check that the failed messages is in the error queue
473
572
  error_queue = @client.queue(error_queue_name)
474
573
  em = error_queue.get
@@ -482,14 +581,14 @@ class TestPushQueues < TestBase
482
581
  assert_equal orig_id, error_hash['source_msg_id']
483
582
  assert_not_nil error_hash['msg']
484
583
  em.delete
485
-
584
+
486
585
  # now let's get the original message
487
586
  orig_msg = queue.get_message(error_hash['source_msg_id'])
488
587
  puts "orig_msg:"
489
588
  p orig_msg
490
589
  p orig_msg.body
491
590
  assert msg, orig_msg.body
492
-
591
+
493
592
  error_queue.delete_queue
494
593
  # delete queue on test complete
495
594
  resp = queue.delete_queue
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iron_mq
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.5
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Yantsevich
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-15 00:00:00.000000000 Z
12
+ date: 2014-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: iron_core
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  version: 1.3.6
220
220
  requirements: []
221
221
  rubyforge_project:
222
- rubygems_version: 2.1.11
222
+ rubygems_version: 2.0.3
223
223
  signing_key:
224
224
  specification_version: 4
225
225
  summary: Ruby client for IronMQ by www.iron.io