bunny 0.7.6 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -0
- data/Rakefile +7 -19
- data/bunny.gemspec +0 -1
- data/lib/bunny/version.rb +1 -1
- data/lib/qrack/client.rb +7 -1
- data/spec/spec_08/bunny_spec.rb +9 -0
- data/spec/spec_08/connection_spec.rb +3 -3
- data/spec/spec_08/exchange_spec.rb +9 -0
- data/spec/spec_08/queue_spec.rb +25 -11
- data/spec/spec_09/amqp_url_spec.rb +1 -0
- data/spec/spec_09/bunny_spec.rb +9 -0
- data/spec/spec_09/connection_spec.rb +3 -3
- data/spec/spec_09/exchange_spec.rb +9 -0
- data/spec/spec_09/queue_spec.rb +24 -10
- metadata +25 -40
data/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
= Version 0.7.8
|
2
|
+
|
3
|
+
* test suite cleanup (eliminated some race conditions related to queue.message_count)
|
4
|
+
|
5
|
+
= Version 0.7.7
|
6
|
+
|
7
|
+
* avoid warnings caused by duplicating code from the amq-client gem
|
8
|
+
|
1
9
|
= Version 0.7.6
|
2
10
|
|
3
11
|
* API mismatch between Timer/SystemTimer on Ruby 1.9 vs Ruby 1.8 is resolved.
|
data/Rakefile
CHANGED
@@ -1,26 +1,14 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
4
|
-
task :spec08 do
|
5
|
-
require 'rspec/core/rake_task'
|
6
|
-
puts "===== Running 0-8 tests ====="
|
7
|
-
RSpec::Core::RakeTask.new("spec08") do |t|
|
8
|
-
t.pattern = "spec/spec_08/*_spec.rb"
|
9
|
-
t.rspec_opts = ['--color']
|
10
|
-
end
|
11
|
-
end
|
3
|
+
require "bundler/gem_tasks"
|
12
4
|
|
13
|
-
desc "Run
|
14
|
-
task :
|
5
|
+
desc "Run rspec tests"
|
6
|
+
task :spec do
|
15
7
|
require 'rspec/core/rake_task'
|
16
|
-
|
17
|
-
|
18
|
-
t.
|
19
|
-
t.rspec_opts = ['--color']
|
8
|
+
RSpec::Core::RakeTask.new("spec") do |t|
|
9
|
+
t.pattern = "spec/spec_*/*_spec.rb"
|
10
|
+
t.rspec_opts = ['--color', '--format doc']
|
20
11
|
end
|
21
12
|
end
|
22
13
|
|
23
|
-
task :default => [ :
|
24
|
-
|
25
|
-
desc "Run all rspec tests"
|
26
|
-
task :all => [:spec08, :spec09]
|
14
|
+
task :default => [ :spec ]
|
data/bunny.gemspec
CHANGED
data/lib/bunny/version.rb
CHANGED
data/lib/qrack/client.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
begin
|
4
|
+
# try loading AMQ::Client::Setttings form the amq client gem, if it has been already loaded
|
5
|
+
# this avoids "warning: already initialized constant AMQP_PORTS"
|
6
|
+
require "amq/client/settings"
|
7
|
+
rescue LoadError
|
8
|
+
require "qrack/amq-client-url"
|
9
|
+
end
|
4
10
|
|
5
11
|
module Qrack
|
6
12
|
|
data/spec/spec_08/bunny_spec.rb
CHANGED
@@ -13,10 +13,10 @@ describe Bunny do
|
|
13
13
|
|
14
14
|
it "should be able to open a TCPSocket with a timeout" do
|
15
15
|
b = Bunny.new(:spec => "0.8")
|
16
|
-
connect_timeout =
|
17
|
-
lambda {
|
16
|
+
connect_timeout = 5
|
17
|
+
lambda {
|
18
18
|
Bunny::Timer::timeout(connect_timeout, Qrack::ConnectionTimeout) do
|
19
|
-
TCPSocket.new(b.host, b.port)
|
19
|
+
TCPSocket.new(b.host, b.port)
|
20
20
|
end
|
21
21
|
}.should_not raise_error(Exception)
|
22
22
|
end
|
@@ -17,6 +17,15 @@ describe 'Exchange' do
|
|
17
17
|
@b.start
|
18
18
|
end
|
19
19
|
|
20
|
+
after(:each) do
|
21
|
+
begin
|
22
|
+
@b.stop
|
23
|
+
rescue Exception
|
24
|
+
ensure
|
25
|
+
@b = nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
20
29
|
it "should raise an error if instantiated as non-existent type" do
|
21
30
|
lambda { @b.exchange('bogus_ex', :type => :bogus) }.should raise_error(Bunny::ForcedConnectionCloseError)
|
22
31
|
@b.status.should == :not_connected
|
data/spec/spec_08/queue_spec.rb
CHANGED
@@ -16,11 +16,25 @@ describe 'Queue' do
|
|
16
16
|
Bunny.should_receive(:deprecation_warning).with("Qrack::Queue#publish", "0.8", anything).exactly(n).times
|
17
17
|
end
|
18
18
|
|
19
|
+
def message_count(queue, sleep_time = 0.1)
|
20
|
+
sleep sleep_time
|
21
|
+
queue.message_count
|
22
|
+
end
|
23
|
+
|
19
24
|
before(:each) do
|
20
25
|
@b = Bunny.new
|
21
26
|
@b.start
|
22
27
|
end
|
23
28
|
|
29
|
+
after(:each) do
|
30
|
+
begin
|
31
|
+
@b.stop
|
32
|
+
rescue Exception
|
33
|
+
ensure
|
34
|
+
@b = nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
24
38
|
it "should ignore the :nowait option when instantiated" do
|
25
39
|
q = @b.queue('test0', :nowait => true)
|
26
40
|
end
|
@@ -65,7 +79,7 @@ describe 'Queue' do
|
|
65
79
|
q = @b.queue('test1')
|
66
80
|
expect_deprecation_warning_for_publishing_on_queue(q)
|
67
81
|
q.publish('This is a test message')
|
68
|
-
q.
|
82
|
+
message_count(q).should == 1
|
69
83
|
end
|
70
84
|
|
71
85
|
it "should be able to pop a message complete with header and delivery details" do
|
@@ -75,7 +89,7 @@ describe 'Queue' do
|
|
75
89
|
msg[:header].should be_an_instance_of(Bunny::Protocol::Header)
|
76
90
|
msg[:payload].should == 'This is a test message'
|
77
91
|
msg[:delivery_details].should be_an_instance_of(Hash)
|
78
|
-
q.
|
92
|
+
message_count(q).should == 0
|
79
93
|
end
|
80
94
|
|
81
95
|
it "should be able to pop a message and just get the payload" do
|
@@ -84,7 +98,7 @@ describe 'Queue' do
|
|
84
98
|
q.publish('This is another test message')
|
85
99
|
msg = q.pop[:payload]
|
86
100
|
msg.should == 'This is another test message'
|
87
|
-
q.
|
101
|
+
message_count(q).should == 0
|
88
102
|
end
|
89
103
|
|
90
104
|
it "should be able to pop a message where body length exceeds max frame size" do
|
@@ -108,15 +122,15 @@ describe 'Queue' do
|
|
108
122
|
q = @b.queue('test1')
|
109
123
|
expect_deprecation_warning_for_publishing_on_queue(q, 5)
|
110
124
|
5.times {q.publish('This is another test message')}
|
111
|
-
q.
|
125
|
+
message_count(q).should == 5
|
112
126
|
lambda {q.purge(:queue => 'bogus')}.should raise_error(Bunny::ForcedChannelCloseError)
|
113
127
|
end
|
114
128
|
|
115
129
|
it "should be able to be purged to remove all of its messages" do
|
116
130
|
q = @b.queue('test1')
|
117
|
-
q.
|
131
|
+
message_count(q).should == 5
|
118
132
|
q.purge.should == :purge_ok
|
119
|
-
q.
|
133
|
+
message_count(q).should == 0
|
120
134
|
end
|
121
135
|
|
122
136
|
it "should return an empty message when popping an empty queue" do
|
@@ -132,9 +146,9 @@ describe 'Queue' do
|
|
132
146
|
q = @b.queue('test1')
|
133
147
|
expect_deprecation_warning_for_publishing_on_queue(q, 5)
|
134
148
|
5.times {q.publish('Yet another test message')}
|
135
|
-
q.
|
149
|
+
message_count(q).should == 5
|
136
150
|
q.subscribe(:message_max => 0)
|
137
|
-
q.
|
151
|
+
message_count(q).should == 5
|
138
152
|
q.purge.should == :purge_ok
|
139
153
|
end
|
140
154
|
|
@@ -142,7 +156,7 @@ describe 'Queue' do
|
|
142
156
|
q = @b.queue('test1')
|
143
157
|
expect_deprecation_warning_for_publishing_on_queue(q, 5)
|
144
158
|
5.times {q.publish('Yet another test message')}
|
145
|
-
q.
|
159
|
+
message_count(q).should == 5
|
146
160
|
q.subscribe(:message_max => 5)
|
147
161
|
end
|
148
162
|
|
@@ -151,9 +165,9 @@ describe 'Queue' do
|
|
151
165
|
@b.qos()
|
152
166
|
expect_deprecation_warning_for_publishing_on_queue(q, 10)
|
153
167
|
10.times {q.publish('Yet another test message')}
|
154
|
-
q.
|
168
|
+
message_count(q).should == 10
|
155
169
|
q.subscribe(:message_max => 5, :ack => true)
|
156
|
-
q.
|
170
|
+
message_count(q).should == 5
|
157
171
|
q.purge.should == :purge_ok
|
158
172
|
end
|
159
173
|
|
data/spec/spec_09/bunny_spec.rb
CHANGED
@@ -18,10 +18,10 @@ describe Bunny do
|
|
18
18
|
|
19
19
|
it "should be able to open a TCPSocket with a timeout" do
|
20
20
|
b = Bunny.new(:spec => "0.9")
|
21
|
-
connect_timeout =
|
22
|
-
lambda {
|
21
|
+
connect_timeout = 5
|
22
|
+
lambda {
|
23
23
|
Bunny::Timer::timeout(connect_timeout, Qrack::ConnectionTimeout) do
|
24
|
-
TCPSocket.new(b.host, b.port)
|
24
|
+
TCPSocket.new(b.host, b.port)
|
25
25
|
end
|
26
26
|
}.should_not raise_error(Exception)
|
27
27
|
end
|
@@ -17,6 +17,15 @@ describe 'Exchange' do
|
|
17
17
|
@b.start
|
18
18
|
end
|
19
19
|
|
20
|
+
after(:each) do
|
21
|
+
begin
|
22
|
+
@b.stop
|
23
|
+
rescue Exception
|
24
|
+
ensure
|
25
|
+
@b = nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
20
29
|
it "should raise an error if instantiated as non-existent type" do
|
21
30
|
lambda { @b.exchange('bogus_ex', :type => :bogus) }.should raise_error(Bunny::ForcedConnectionCloseError)
|
22
31
|
@b.status.should == :not_connected
|
data/spec/spec_09/queue_spec.rb
CHANGED
@@ -19,6 +19,20 @@ describe 'Queue' do
|
|
19
19
|
@default_exchange = @b.exchange("")
|
20
20
|
end
|
21
21
|
|
22
|
+
after(:each) do
|
23
|
+
begin
|
24
|
+
@b.stop
|
25
|
+
rescue Exception
|
26
|
+
ensure
|
27
|
+
@b = nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def message_count(queue, sleep_time = 0.1)
|
32
|
+
sleep sleep_time
|
33
|
+
queue.message_count
|
34
|
+
end
|
35
|
+
|
22
36
|
it "should ignore the :nowait option when instantiated" do
|
23
37
|
q = @b.queue('test0', :nowait => true)
|
24
38
|
end
|
@@ -67,7 +81,7 @@ describe 'Queue' do
|
|
67
81
|
msg[:header].should be_an_instance_of(Bunny::Protocol09::Header)
|
68
82
|
msg[:payload].should == 'This is a test message'
|
69
83
|
msg[:delivery_details].should be_an_instance_of(Hash)
|
70
|
-
q.
|
84
|
+
message_count(q).should == 0
|
71
85
|
end
|
72
86
|
|
73
87
|
it "should be able to pop a message and just get the payload" do
|
@@ -75,7 +89,7 @@ describe 'Queue' do
|
|
75
89
|
@default_exchange.publish('This is another test message', :key => 'test1')
|
76
90
|
msg = q.pop[:payload]
|
77
91
|
msg.should == 'This is another test message'
|
78
|
-
q.
|
92
|
+
message_count(q).should == 0
|
79
93
|
end
|
80
94
|
|
81
95
|
it "should be able to pop a message where body length exceeds max frame size" do
|
@@ -96,15 +110,15 @@ describe 'Queue' do
|
|
96
110
|
it "should raise an error if purge fails" do
|
97
111
|
q = @b.queue('test1')
|
98
112
|
5.times { @default_exchange.publish('This is another test message', :key => 'test1') }
|
99
|
-
q.
|
113
|
+
message_count(q).should == 5
|
100
114
|
lambda {q.purge(:queue => 'bogus')}.should raise_error(Bunny::ForcedChannelCloseError)
|
101
115
|
end
|
102
116
|
|
103
117
|
it "should be able to be purged to remove all of its messages" do
|
104
118
|
q = @b.queue('test1')
|
105
|
-
q.
|
119
|
+
message_count(q).should == 5
|
106
120
|
q.purge.should == :purge_ok
|
107
|
-
q.
|
121
|
+
message_count(q).should == 0
|
108
122
|
end
|
109
123
|
|
110
124
|
it "should return an empty message when popping an empty queue" do
|
@@ -118,16 +132,16 @@ describe 'Queue' do
|
|
118
132
|
it "should stop subscription without processing messages if max specified is 0" do
|
119
133
|
q = @b.queue('test1')
|
120
134
|
5.times { @default_exchange.publish('Yet another test message', :key => 'test1') }
|
121
|
-
q.
|
135
|
+
message_count(q).should == 5
|
122
136
|
q.subscribe(:message_max => 0)
|
123
|
-
q.
|
137
|
+
message_count(q).should == 5
|
124
138
|
q.purge.should == :purge_ok
|
125
139
|
end
|
126
140
|
|
127
141
|
it "should stop subscription after processing number of messages specified > 0" do
|
128
142
|
q = @b.queue('test1')
|
129
143
|
5.times { @default_exchange.publish('Yet another test message', :key => 'test1') }
|
130
|
-
q.
|
144
|
+
message_count(q).should == 5
|
131
145
|
q.subscribe(:message_max => 5)
|
132
146
|
end
|
133
147
|
|
@@ -135,9 +149,9 @@ describe 'Queue' do
|
|
135
149
|
q = @b.queue('test1')
|
136
150
|
@b.qos()
|
137
151
|
10.times { @default_exchange.publish('Yet another test message', :key => 'test1') }
|
138
|
-
q.
|
152
|
+
message_count(q).should == 10
|
139
153
|
q.subscribe(:message_max => 5, :ack => true)
|
140
|
-
q.
|
154
|
+
message_count(q).should == 5
|
141
155
|
q.purge.should == :purge_ok
|
142
156
|
end
|
143
157
|
|
metadata
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: bunny
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.8
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
- 6
|
10
|
-
version: 0.7.6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Chris Duncan
|
14
9
|
- Eric Lindvall
|
15
10
|
- Jakub Stastny aka botanicus
|
@@ -18,25 +13,22 @@ authors:
|
|
18
13
|
autorequire:
|
19
14
|
bindir: bin
|
20
15
|
cert_chain: []
|
21
|
-
|
22
|
-
date: 2011-09-21 00:00:00 +04:00
|
16
|
+
date: 2011-10-11 00:00:00.000000000 +02:00
|
23
17
|
default_executable:
|
24
18
|
dependencies: []
|
25
|
-
|
26
|
-
|
27
|
-
email:
|
19
|
+
description: A synchronous Ruby AMQP client that enables interaction with AMQP-compliant
|
20
|
+
brokers.
|
21
|
+
email:
|
28
22
|
- celldee@gmail.com
|
29
23
|
- eric@5stops.com
|
30
24
|
- stastny@101ideas.cz
|
31
25
|
- michael@novemberain.com
|
32
26
|
- skaes@railsexpress.de
|
33
27
|
executables: []
|
34
|
-
|
35
28
|
extensions: []
|
36
|
-
|
37
|
-
extra_rdoc_files:
|
29
|
+
extra_rdoc_files:
|
38
30
|
- README.textile
|
39
|
-
files:
|
31
|
+
files:
|
40
32
|
- .gitignore
|
41
33
|
- .rspec
|
42
34
|
- .travis.yml
|
@@ -107,39 +99,32 @@ files:
|
|
107
99
|
has_rdoc: true
|
108
100
|
homepage: http://github.com/ruby-amqp/bunny
|
109
101
|
licenses: []
|
110
|
-
|
111
|
-
|
112
|
-
rdoc_options:
|
102
|
+
post_install_message: ! "[\e[32mVersion 0.7.8\e[0m] test suite cleanup (eliminated
|
103
|
+
some race conditions related to queue.message_count)\n"
|
104
|
+
rdoc_options:
|
113
105
|
- --main
|
114
106
|
- README.rdoc
|
115
|
-
require_paths:
|
107
|
+
require_paths:
|
116
108
|
- lib
|
117
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
110
|
none: false
|
119
|
-
requirements:
|
120
|
-
- -
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
|
123
|
-
|
124
|
-
- 0
|
125
|
-
version: "0"
|
126
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
116
|
none: false
|
128
|
-
requirements:
|
129
|
-
- -
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
|
132
|
-
segments:
|
133
|
-
- 0
|
134
|
-
version: "0"
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
135
121
|
requirements: []
|
136
|
-
|
137
122
|
rubyforge_project: bunny-amqp
|
138
123
|
rubygems_version: 1.6.2
|
139
124
|
signing_key:
|
140
125
|
specification_version: 3
|
141
126
|
summary: Synchronous Ruby AMQP 0.9.1 client
|
142
|
-
test_files:
|
127
|
+
test_files:
|
143
128
|
- spec/spec_08/bunny_spec.rb
|
144
129
|
- spec/spec_08/connection_spec.rb
|
145
130
|
- spec/spec_08/exchange_spec.rb
|