symphony 0.12.5 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'set'
5
5
  require 'pluggability'
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'set'
5
5
  require 'symphony/task_group' unless defined?( Symphony::TaskGroup )
@@ -96,7 +96,7 @@ class Symphony::TaskGroup::LongLived < Symphony::TaskGroup
96
96
  end
97
97
 
98
98
  return @queue
99
- rescue Bunny::NotFound, Bunny::ChannelAlreadyClosed => err
99
+ rescue Bunny::NotFound, Bunny::ChannelAlreadyClosed
100
100
  self.log.info "Child hasn't created the queue yet; deferring"
101
101
  Symphony::Queue.reset
102
102
 
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require 'symphony/task_group' unless defined?( Symphony::TaskGroup )
5
5
 
data/spec/helpers.rb CHANGED
@@ -48,6 +48,10 @@ module Symphony::SpecHelpers
48
48
  def initialize
49
49
  @queue = nil
50
50
  @exchange = nil
51
+ @open = true
52
+ end
53
+ def open?
54
+ return @open
51
55
  end
52
56
  def queue( name, opts={} )
53
57
  return @queue ||= DummySession::Queue.new( self )
@@ -60,7 +64,9 @@ module Symphony::SpecHelpers
60
64
  def number
61
65
  return 1
62
66
  end
63
- def close; end
67
+ def close
68
+ @open = false
69
+ end
64
70
  end
65
71
 
66
72
  class Exchange
@@ -86,14 +92,24 @@ end
86
92
 
87
93
  ### Mock with RSpec
88
94
  RSpec.configure do |config|
89
- config.run_all_when_everything_filtered = true
90
- config.filter_run :focus
91
- config.order = 'random'
92
- config.expect_with( :rspec )
93
- config.mock_with( :rspec ) do |mock|
94
- mock.syntax = :expect
95
+ config.expect_with :rspec do |expectations|
96
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
97
+ expectations.syntax = :expect
98
+ end
99
+
100
+ config.mock_with :rspec do |mocks|
101
+ mocks.verify_partial_doubles = true
95
102
  end
96
103
 
104
+ config.run_all_when_everything_filtered = true
105
+ config.filter_run_when_matching :focus
106
+ config.order = :random
107
+ config.example_status_persistence_file_path = 'spec/.state'
108
+ config.disable_monkey_patching!
109
+ config.warnings = true
110
+ config.profile_examples = 5
111
+
112
+
97
113
  config.include( Loggability::SpecHelpers )
98
114
  config.include( Symphony::SpecHelpers )
99
115
  end
@@ -1,5 +1,5 @@
1
1
  # -*- ruby -*-
2
- #encoding: utf-8
2
+ # frozen_string_literal: true
3
3
  # vim: set noet nosta sw=4 ts=4 :
4
4
 
5
5
 
@@ -19,7 +19,7 @@ class Test3Task < Symphony::Task
19
19
  end
20
20
 
21
21
 
22
- describe Symphony::Daemon do
22
+ RSpec.describe Symphony::Daemon do
23
23
 
24
24
  before( :all ) do
25
25
  @pids = ( 200..65534 ).cycle
@@ -5,12 +5,16 @@ require_relative '../helpers'
5
5
  require 'symphony/mixins'
6
6
 
7
7
 
8
- describe Symphony, 'mixins' do
8
+ RSpec.describe Symphony, 'mixins' do
9
9
 
10
10
  describe Symphony::MethodUtilities, 'used to extend a class' do
11
11
 
12
12
  let!( :extended_class ) do
13
- klass = Class.new
13
+ klass = Class.new do
14
+ def initialize
15
+ @foo = nil
16
+ end
17
+ end
14
18
  klass.extend( Symphony::MethodUtilities )
15
19
  klass
16
20
  end
@@ -4,7 +4,7 @@ require_relative '../helpers'
4
4
 
5
5
  require 'symphony/queue'
6
6
 
7
- describe Symphony::Queue do
7
+ RSpec.describe Symphony::Queue do
8
8
 
9
9
 
10
10
  before( :each ) do
@@ -128,7 +128,33 @@ describe Symphony::Queue do
128
128
  expect( new_channel ).to receive( :prefetch ).
129
129
  with( Symphony::Queue::DEFAULT_PREFETCH )
130
130
  expect( new_channel ).to receive( :queue ).
131
- with( queue.name, auto_delete: true ).
131
+ with( queue.name, auto_delete: true, arguments: {} ).
132
+ and_return( amqp_queue )
133
+ expect( amqp_queue ).to receive( :bind ).
134
+ with( described_class.amqp_exchange, routing_key: 'floppy.rabbit.#' )
135
+
136
+ expect( queue.create_amqp_queue ).to be( amqp_queue )
137
+ end
138
+
139
+
140
+ it "can declare the queue's x-queue-type" do
141
+ testing_task_class.subscribe_to( 'floppy.rabbit.#' )
142
+ testing_task_class.queue_type( 'classic' )
143
+ expect( described_class.amqp_channel ).to receive( :queue ).
144
+ with( queue.name, passive: true ).
145
+ and_raise( Bunny::NotFound.new("no such queue", described_class.amqp_channel, true) )
146
+ expect( described_class.amqp_channel ).to receive( :open? ).
147
+ and_return( false )
148
+
149
+ # Channel is reset after queue creation fails
150
+ new_channel = double( "New AMQP channel" )
151
+ amqp_queue = double( "AMQP queue" )
152
+ allow( described_class.amqp_session ).to receive( :create_channel ).
153
+ and_return( new_channel )
154
+ expect( new_channel ).to receive( :prefetch ).
155
+ with( Symphony::Queue::DEFAULT_PREFETCH )
156
+ expect( new_channel ).to receive( :queue ).
157
+ with( queue.name, auto_delete: true, arguments: { 'x-queue-type' => 'classic' } ).
132
158
  and_return( amqp_queue )
133
159
  expect( amqp_queue ).to receive( :bind ).
134
160
  with( described_class.amqp_exchange, routing_key: 'floppy.rabbit.#' )
@@ -7,7 +7,7 @@ require 'symphony'
7
7
  require 'symphony/routing'
8
8
 
9
9
 
10
- describe Symphony::Routing do
10
+ RSpec.describe Symphony::Routing do
11
11
 
12
12
  let( :task_class ) do
13
13
  Class.new( Symphony::Task ) do
@@ -5,7 +5,7 @@ require_relative '../helpers'
5
5
  require 'symphony/statistics'
6
6
 
7
7
 
8
- describe Symphony::Statistics do
8
+ RSpec.describe Symphony::Statistics do
9
9
 
10
10
 
11
11
  let( :including_class ) do
@@ -4,7 +4,7 @@ require_relative '../../helpers'
4
4
 
5
5
  require 'symphony/task_group/longlived'
6
6
 
7
- describe Symphony::TaskGroup::LongLived do
7
+ RSpec.describe Symphony::TaskGroup::LongLived do
8
8
 
9
9
  FIRST_PID = 414
10
10
 
@@ -5,7 +5,7 @@ require_relative '../../helpers'
5
5
  require 'symphony/task_group/oneshot'
6
6
 
7
7
 
8
- describe Symphony::TaskGroup::Oneshot do
8
+ RSpec.describe Symphony::TaskGroup::Oneshot do
9
9
 
10
10
  let( :task ) do
11
11
  Class.new( Symphony::Task ) do
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative '../helpers'
4
4
 
5
- describe Symphony::TaskGroup do
5
+ RSpec.describe Symphony::TaskGroup do
6
6
 
7
7
  let( :task ) do
8
8
  Class.new( Symphony::Task ) do
@@ -4,7 +4,7 @@ require_relative '../helpers'
4
4
 
5
5
  require 'symphony/task'
6
6
 
7
- describe Symphony::Task do
7
+ RSpec.describe Symphony::Task do
8
8
 
9
9
  before( :all ) do
10
10
  Symphony::Queue.configure
@@ -70,7 +70,7 @@ describe Symphony::Task do
70
70
  end
71
71
  end
72
72
  let( :payload ) {{ "the" => "payload" }}
73
- let( :serialized_payload ) { Yajl.dump(payload) }
73
+ let( :serialized_payload ) { JSON.generate(payload) }
74
74
  let( :metadata ) {{ :content_type => 'application/json' }}
75
75
  let( :queue ) do
76
76
  obj = Symphony::Queue.for_task( task_class )
@@ -99,6 +99,23 @@ describe Symphony::Task do
99
99
  end
100
100
 
101
101
 
102
+ it "can set the x-queue-type for the queue" do
103
+ task = Class.new( described_class ) do
104
+ queue_name 'wascally.wabbit'
105
+ queue_type 'classic'
106
+ end
107
+ expect( task.queue_type ).to eq( 'classic' )
108
+ end
109
+
110
+
111
+ it "has a queue type of nil if unspecified" do
112
+ task = Class.new( described_class ) do
113
+ queue_name 'wascally.wabbit'
114
+ end
115
+ expect( task.queue_type ).to eq( nil )
116
+ end
117
+
118
+
102
119
  it "can set the number of messages to prefetch" do
103
120
  task_class.prefetch( 10 )
104
121
  expect( task_class.prefetch ).to eq( 10 )
@@ -6,7 +6,7 @@ require 'rspec'
6
6
  require 'symphony'
7
7
 
8
8
 
9
- describe Symphony do
9
+ RSpec.describe Symphony do
10
10
 
11
11
  before( :each ) do
12
12
  ENV.delete( 'SYMPHONY_CONFIG' )
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: symphony
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.5
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
8
8
  - Mahlon E. Smith
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
12
  - |
13
13
  -----BEGIN CERTIFICATE-----
14
14
  MIIENDCCApygAwIBAgIBATANBgkqhkiG9w0BAQsFADAiMSAwHgYDVQQDDBdnZWQv
15
- REM9RmFlcmllTVVEL0RDPW9yZzAeFw0xODExMjAxODI5NTlaFw0xOTExMjAxODI5
16
- NTlaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
15
+ REM9RmFlcmllTVVEL0RDPW9yZzAeFw0xOTEwMDkwMDM2NTdaFw0yMDEwMDgwMDM2
16
+ NTdaMCIxIDAeBgNVBAMMF2dlZC9EQz1GYWVyaWVNVUQvREM9b3JnMIIBojANBgkq
17
17
  hkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAvyVhkRzvlEs0fe7145BYLfN6njX9ih5H
18
18
  L60U0p0euIurpv84op9CNKF9tx+1WKwyQvQP7qFGuZxkSUuWcP/sFhDXL1lWUuIl
19
19
  M4uHbGCRmOshDrF4dgnBeOvkHr1fIhPlJm5FO+Vew8tSQmlDsosxLUx+VB7DrVFO
@@ -25,32 +25,38 @@ cert_chain:
25
25
  N2I4L/ZOIe2DIVuYH7aLHfjZDQv/mNgpAgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYD
26
26
  VR0PBAQDAgSwMB0GA1UdDgQWBBRyjf55EbrHagiRLqt5YAd3yb8k4DAcBgNVHREE
27
27
  FTATgRFnZWRARmFlcmllTVVELm9yZzAcBgNVHRIEFTATgRFnZWRARmFlcmllTV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ANaKsg
35
+ jBZSA+N+xUTgUWpXjjwsLZjzJkhWATJWq+krNXcqpwXo6HsjmdUxoFMt63RBb+sI
36
+ XrxOxp8o0uOkU7FdLSGsyqJ2LzsR4obN
37
37
  -----END CERTIFICATE-----
38
- date: 2019-07-16 00:00:00.000000000 Z
38
+ date: 2020-07-23 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: configurability
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - "~>"
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '3.1'
47
+ - - "<="
48
+ - !ruby/object:Gem::Version
49
+ version: '4.99'
47
50
  type: :runtime
48
51
  prerelease: false
49
52
  version_requirements: !ruby/object:Gem::Requirement
50
53
  requirements:
51
- - - "~>"
54
+ - - ">="
52
55
  - !ruby/object:Gem::Version
53
56
  version: '3.1'
57
+ - - "<="
58
+ - !ruby/object:Gem::Version
59
+ version: '4.99'
54
60
  - !ruby/object:Gem::Dependency
55
61
  name: loggability
56
62
  requirement: !ruby/object:Gem::Requirement
@@ -107,20 +113,6 @@ dependencies:
107
113
  - - "~>"
108
114
  - !ruby/object:Gem::Version
109
115
  version: '1.1'
110
- - !ruby/object:Gem::Dependency
111
- name: yajl-ruby
112
- requirement: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '1.3'
117
- type: :runtime
118
- prerelease: false
119
- version_requirements: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '1.3'
124
116
  - !ruby/object:Gem::Dependency
125
117
  name: msgpack
126
118
  requirement: !ruby/object:Gem::Requirement
@@ -164,61 +156,33 @@ dependencies:
164
156
  - !ruby/object:Gem::Version
165
157
  version: '0.2'
166
158
  - !ruby/object:Gem::Dependency
167
- name: hoe-mercurial
168
- requirement: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '1.4'
173
- type: :development
174
- prerelease: false
175
- version_requirements: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '1.4'
180
- - !ruby/object:Gem::Dependency
181
- name: hoe-deveiate
182
- requirement: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: '0.10'
187
- type: :development
188
- prerelease: false
189
- version_requirements: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - "~>"
192
- - !ruby/object:Gem::Version
193
- version: '0.10'
194
- - !ruby/object:Gem::Dependency
195
- name: hoe-highline
159
+ name: rake-deveiate
196
160
  requirement: !ruby/object:Gem::Requirement
197
161
  requirements:
198
162
  - - "~>"
199
163
  - !ruby/object:Gem::Version
200
- version: '0.2'
164
+ version: '0.12'
201
165
  type: :development
202
166
  prerelease: false
203
167
  version_requirements: !ruby/object:Gem::Requirement
204
168
  requirements:
205
169
  - - "~>"
206
170
  - !ruby/object:Gem::Version
207
- version: '0.2'
171
+ version: '0.12'
208
172
  - !ruby/object:Gem::Dependency
209
- name: rspec
173
+ name: rdoc-generator-fivefish
210
174
  requirement: !ruby/object:Gem::Requirement
211
175
  requirements:
212
176
  - - "~>"
213
177
  - !ruby/object:Gem::Version
214
- version: '3.0'
178
+ version: '0.4'
215
179
  type: :development
216
180
  prerelease: false
217
181
  version_requirements: !ruby/object:Gem::Requirement
218
182
  requirements:
219
183
  - - "~>"
220
184
  - !ruby/object:Gem::Version
221
- version: '3.0'
185
+ version: '0.4'
222
186
  - !ruby/object:Gem::Dependency
223
187
  name: simplecov
224
188
  requirement: !ruby/object:Gem::Requirement
@@ -247,73 +211,22 @@ dependencies:
247
211
  - - "~>"
248
212
  - !ruby/object:Gem::Version
249
213
  version: '0.8'
250
- - !ruby/object:Gem::Dependency
251
- name: rdoc
252
- requirement: !ruby/object:Gem::Requirement
253
- requirements:
254
- - - ">="
255
- - !ruby/object:Gem::Version
256
- version: '4.0'
257
- - - "<"
258
- - !ruby/object:Gem::Version
259
- version: '7'
260
- type: :development
261
- prerelease: false
262
- version_requirements: !ruby/object:Gem::Requirement
263
- requirements:
264
- - - ">="
265
- - !ruby/object:Gem::Version
266
- version: '4.0'
267
- - - "<"
268
- - !ruby/object:Gem::Version
269
- version: '7'
270
- - !ruby/object:Gem::Dependency
271
- name: hoe
272
- requirement: !ruby/object:Gem::Requirement
273
- requirements:
274
- - - "~>"
275
- - !ruby/object:Gem::Version
276
- version: '3.17'
277
- type: :development
278
- prerelease: false
279
- version_requirements: !ruby/object:Gem::Requirement
280
- requirements:
281
- - - "~>"
282
- - !ruby/object:Gem::Version
283
- version: '3.17'
284
- description: |-
285
- Symphony is a subscription-based asynchronous job system. It
286
- allows you to define jobs that watch for lightweight events from a
287
- distributed-messaging AMQP broker, and do work based on their payload.
288
-
289
- It includes several executables under bin/:
290
-
291
- symphony::
292
- A daemon which manages startup and shutdown of one or more Workers
293
- running Tasks as they are published from a queue.
294
-
295
- symphony-task::
296
- A wrapper that runs a single task, useful for testing, or if you don't
297
- require the process management that the symphony daemon provides.
214
+ description: Symphony is a subscription-based asynchronous job system. It allows you
215
+ to define jobs that watch for lightweight events from a distributed-messaging AMQP
216
+ broker, and do work based on their payload.
298
217
  email:
299
- - ged@FaerieMUD.org
218
+ - ged@faeriemud.org
300
219
  - mahlon@martini.nu
301
220
  executables:
302
221
  - symphony
303
222
  - symphony-task
304
223
  extensions: []
305
- extra_rdoc_files:
306
- - History.rdoc
307
- - Manifest.txt
308
- - README.rdoc
309
- - UPGRADING.md
310
- - USAGE.rdoc
224
+ extra_rdoc_files: []
311
225
  files:
312
226
  - ".simplecov"
313
- - ChangeLog
314
227
  - History.rdoc
315
228
  - Manifest.txt
316
- - README.rdoc
229
+ - README.md
317
230
  - Rakefile
318
231
  - UPGRADING.md
319
232
  - USAGE.rdoc
@@ -347,31 +260,32 @@ files:
347
260
  - spec/symphony/task_group_spec.rb
348
261
  - spec/symphony/task_spec.rb
349
262
  - spec/symphony_spec.rb
350
- homepage: http://bitbucket.org/ged/symphony
263
+ homepage: https://hg.sr.ht/~ged/Symphony
351
264
  licenses:
352
- - BSD
353
- metadata: {}
354
- post_install_message:
355
- rdoc_options:
356
- - "-f"
357
- - fivefish
358
- - "-t"
359
- - Symphony
265
+ - BSD-3-Clause
266
+ metadata:
267
+ homepage_uri: https://hg.sr.ht/~ged/Symphony
268
+ documentation_uri: https://deveiate.org/code/symphony
269
+ changelog_uri: https://deveiate.org/code/symphony/History_md.html
270
+ source_uri: https://hg.sr.ht/~ged/Symphony/browse
271
+ bug_tracker_uri: https://todo.sr.ht/~ged/Symphony/browse
272
+ post_install_message:
273
+ rdoc_options: []
360
274
  require_paths:
361
275
  - lib
362
276
  required_ruby_version: !ruby/object:Gem::Requirement
363
277
  requirements:
364
- - - ">="
278
+ - - "~>"
365
279
  - !ruby/object:Gem::Version
366
- version: 2.0.0
280
+ version: '2.6'
367
281
  required_rubygems_version: !ruby/object:Gem::Requirement
368
282
  requirements:
369
283
  - - ">="
370
284
  - !ruby/object:Gem::Version
371
- version: 2.0.3
285
+ version: '0'
372
286
  requirements: []
373
- rubygems_version: 3.0.3
374
- signing_key:
287
+ rubygems_version: 3.1.2
288
+ signing_key:
375
289
  specification_version: 4
376
- summary: Symphony is a subscription-based asynchronous job system
290
+ summary: Symphony is a subscription-based asynchronous job system.
377
291
  test_files: []