beetle 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -28
- data/features/support/system_notification_logger +1 -1
- data/features/support/test_daemons/redis.conf.erb +1 -1
- data/features/support/test_daemons/redis_configuration_client.rb +2 -2
- data/lib/beetle.rb +3 -17
- data/lib/beetle/version.rb +1 -1
- data/test/beetle/amqp_gem_behavior_test.rb +1 -1
- data/test/beetle/base_test.rb +2 -2
- data/test/beetle/beetle_test.rb +1 -1
- data/test/beetle/client_test.rb +3 -3
- data/test/beetle/configuration_test.rb +1 -1
- data/test/beetle/deduplication_store_test.rb +5 -5
- data/test/beetle/handler_test.rb +1 -1
- data/test/beetle/message_test.rb +11 -11
- data/test/beetle/publisher_test.rb +6 -6
- data/test/beetle/r_c_test.rb +1 -1
- data/test/beetle/redis_configuration_client_test.rb +1 -1
- data/test/beetle/redis_configuration_server_test.rb +5 -5
- data/test/beetle/redis_ext_test.rb +4 -4
- data/test/beetle/redis_master_file_test.rb +1 -1
- data/test/beetle/subscriber_test.rb +9 -9
- data/test/test_helper.rb +13 -10
- metadata +2 -5
- data/examples/test_publisher.rb +0 -32
- data/test/colorized_test_output.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f14fdb38e6199024a1c4dccf3684d49086d6229
|
4
|
+
data.tar.gz: 5829af8ed48cfc65087477e7d1fa8add99a0fdf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5b500e3ba9ac11ae2b6e03da63384e4f581c54f92d55fd9d91c522e507112891543f3048f737f379c0ce122dbd74cb772eb1d9eccf5bcdbcf083b3be4414e94
|
7
|
+
data.tar.gz: cd4fd45aad6a2d4ebdfee9001ca1793066fb155cb3db4b22b0a34de796619010414e92e293a73e5d50c0152625a395512e4d0ddc900d936f00911a5c02cc2569
|
data/Rakefile
CHANGED
@@ -10,34 +10,9 @@ require 'cucumber/rake/task'
|
|
10
10
|
$:.unshift 'lib'
|
11
11
|
require 'beetle'
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
namespace :test do
|
17
|
-
namespace :coverage do
|
18
|
-
desc "Delete aggregate coverage data."
|
19
|
-
task(:clean) { rm_f "coverage.data" }
|
20
|
-
end
|
21
|
-
|
22
|
-
desc 'Aggregate code coverage'
|
23
|
-
task :coverage => "test:coverage:clean"
|
24
|
-
|
25
|
-
Rcov::RcovTask.new(:coverage) do |t|
|
26
|
-
t.libs << "test"
|
27
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
28
|
-
t.output_dir = "test/coverage"
|
29
|
-
t.verbose = true
|
30
|
-
t.rcov_opts << "--exclude '.*' --include-file 'lib/beetle/'"
|
31
|
-
end
|
32
|
-
task :coverage do
|
33
|
-
system 'open test/coverage/index.html'
|
34
|
-
end if RUBY_PLATFORM =~ /darwin/
|
35
|
-
end
|
36
|
-
else
|
37
|
-
namespace :test do
|
38
|
-
task :coverage => :test do
|
39
|
-
system 'open coverage/index.html'
|
40
|
-
end
|
13
|
+
namespace :test do
|
14
|
+
task :coverage => :test do
|
15
|
+
system 'open coverage/index.html'
|
41
16
|
end
|
42
17
|
end
|
43
18
|
|
@@ -8,7 +8,7 @@ tmp_path = File.expand_path("../../tmp", File.dirname(__FILE__))
|
|
8
8
|
system_notification_log_file_path = "#{tmp_path}/system_notifications.log"
|
9
9
|
|
10
10
|
Daemons.run_proc("system_notification_logger", :log_output => true, :dir_mode => :normal, :dir => tmp_path) do
|
11
|
-
Beetle.config.servers = "localhost:5672
|
11
|
+
Beetle.config.servers = "localhost:5672" # rabbitmq
|
12
12
|
|
13
13
|
# set Beetle log level to info, less noisy than debug
|
14
14
|
Beetle.config.logger.level = Logger::DEBUG
|
@@ -101,7 +101,7 @@ dir <%= dir %>
|
|
101
101
|
# Once the limit is reached Redis will close all the new connections sending
|
102
102
|
# an error 'max number of clients reached'.
|
103
103
|
#
|
104
|
-
|
104
|
+
maxclients 128
|
105
105
|
|
106
106
|
# Don't use more memory than the specified amount of bytes.
|
107
107
|
# When the memory limit is reached Redis will try to remove keys with an
|
@@ -35,7 +35,7 @@ module TestDaemons
|
|
35
35
|
|
36
36
|
def daemon_controller
|
37
37
|
@daemon_controller ||= DaemonController.new(
|
38
|
-
:identifier => "Redis configuration test client",
|
38
|
+
:identifier => "Redis configuration test client #{@name}",
|
39
39
|
:start_command => "ruby bin/beetle configuration_client start -- -v --redis-master-file #{redis_master_file} --id #{@name} --pid-dir #{tmp_path} --amqp-servers 127.0.0.1:5672",
|
40
40
|
:ping_command => lambda{ true },
|
41
41
|
:pid_file => pid_file,
|
@@ -61,4 +61,4 @@ module TestDaemons
|
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
64
|
-
end
|
64
|
+
end
|
data/lib/beetle.rb
CHANGED
@@ -5,28 +5,14 @@ require 'qrack/errors' # needed by the publisher
|
|
5
5
|
require 'uuid4r'
|
6
6
|
require 'redis/connection/hiredis' # require *before* redis as specified in the redis-rb gem docs
|
7
7
|
require 'redis'
|
8
|
-
require 'active_support'
|
9
|
-
require 'active_support/core_ext'
|
8
|
+
require 'active_support/all'
|
10
9
|
require 'set'
|
11
10
|
require 'socket'
|
12
11
|
require 'beetle/version'
|
13
12
|
|
14
13
|
module Beetle
|
15
|
-
|
16
|
-
Timer =
|
17
|
-
begin
|
18
|
-
require 'system_timer'
|
19
|
-
SystemTimer
|
20
|
-
rescue Exception
|
21
|
-
warn "WARNING: It's highly recommended to install the SystemTimer gem: `gem install SystemTimer -v '=1.2.1'` See: http://ph7spot.com/musings/system-timer" if RUBY_VERSION < "1.9"
|
22
|
-
require 'timeout'
|
23
|
-
Timeout
|
24
|
-
end
|
25
|
-
else
|
26
|
-
require 'timeout'
|
27
|
-
Timeout
|
28
|
-
end
|
29
|
-
#:nocov:
|
14
|
+
require 'timeout'
|
15
|
+
Timer = Timeout
|
30
16
|
|
31
17
|
# abstract superclass for Beetle specific exceptions
|
32
18
|
class Error < StandardError; end
|
data/lib/beetle/version.rb
CHANGED
@@ -4,7 +4,7 @@ require 'amqp'
|
|
4
4
|
|
5
5
|
AMQP.client.logger = Beetle.config.logger
|
6
6
|
|
7
|
-
class AMQPGemBehaviorTest <
|
7
|
+
class AMQPGemBehaviorTest < MiniTest::Unit::TestCase
|
8
8
|
test "subscribing twice to the same queue raises a RuntimeError which throws us out of the event loop" do
|
9
9
|
begin
|
10
10
|
exception = nil
|
data/test/beetle/base_test.rb
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
|
2
2
|
|
3
3
|
|
4
4
|
module Beetle
|
5
|
-
class BaseTest <
|
5
|
+
class BaseTest < MiniTest::Unit::TestCase
|
6
6
|
test "initially we should have no exchanges" do
|
7
7
|
@bs = Base.new(Client.new)
|
8
8
|
assert_equal({}, @bs.instance_variable_get("@exchanges"))
|
@@ -19,7 +19,7 @@ module Beetle
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
class BaseServerManagementTest <
|
22
|
+
class BaseServerManagementTest < MiniTest::Unit::TestCase
|
23
23
|
def setup
|
24
24
|
@client = Client.new
|
25
25
|
@bs = Base.new(@client)
|
data/test/beetle/beetle_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
2
|
|
3
3
|
module Beetle
|
4
|
-
class HostnameTest <
|
4
|
+
class HostnameTest < MiniTest::Unit::TestCase
|
5
5
|
test "should use Socket.gethostname if returned name name is fully qualified" do
|
6
6
|
Socket.expects(:gethostname).returns("a.b.com")
|
7
7
|
assert_equal "a.b.com", Beetle.hostname
|
data/test/beetle/client_test.rb
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
|
2
2
|
|
3
3
|
|
4
4
|
module Beetle
|
5
|
-
class ClientDefaultsTest <
|
5
|
+
class ClientDefaultsTest < MiniTest::Unit::TestCase
|
6
6
|
def setup
|
7
7
|
@client = Client.new
|
8
8
|
end
|
@@ -32,7 +32,7 @@ module Beetle
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
class RegistrationTest <
|
35
|
+
class RegistrationTest < MiniTest::Unit::TestCase
|
36
36
|
def setup
|
37
37
|
@client = Client.new
|
38
38
|
end
|
@@ -203,7 +203,7 @@ module Beetle
|
|
203
203
|
|
204
204
|
end
|
205
205
|
|
206
|
-
class ClientTest <
|
206
|
+
class ClientTest < MiniTest::Unit::TestCase
|
207
207
|
test "instantiating a client should not instantiate the subscriber/publisher" do
|
208
208
|
Publisher.expects(:new).never
|
209
209
|
Subscriber.expects(:new).never
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
2
|
|
3
3
|
module Beetle
|
4
|
-
class ConfigurationTest <
|
4
|
+
class ConfigurationTest < MiniTest::Unit::TestCase
|
5
5
|
test "should load it's settings from a config file if that file exists" do
|
6
6
|
config = Configuration.new
|
7
7
|
old_value = config.gc_threshold
|
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
|
2
2
|
|
3
3
|
module Beetle
|
4
4
|
|
5
|
-
class RedisAssumptionsTest <
|
5
|
+
class RedisAssumptionsTest < MiniTest::Unit::TestCase
|
6
6
|
def setup
|
7
7
|
@r = DeduplicationStore.new.redis
|
8
8
|
@r.flushdb
|
@@ -23,7 +23,7 @@ module Beetle
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
class RedisServerStringTest <
|
26
|
+
class RedisServerStringTest < MiniTest::Unit::TestCase
|
27
27
|
def setup
|
28
28
|
@original_redis_server = Beetle.config.redis_server
|
29
29
|
@store = DeduplicationStore.new
|
@@ -40,7 +40,7 @@ module Beetle
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
class RedisServerFileTest <
|
43
|
+
class RedisServerFileTest < MiniTest::Unit::TestCase
|
44
44
|
def setup
|
45
45
|
@original_redis_server = Beetle.config.redis_server
|
46
46
|
@store = DeduplicationStore.new
|
@@ -81,7 +81,7 @@ module Beetle
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
class RedisFailoverTest <
|
84
|
+
class RedisFailoverTest < MiniTest::Unit::TestCase
|
85
85
|
def setup
|
86
86
|
@store = DeduplicationStore.new
|
87
87
|
Beetle.config.expects(:redis_failover_timeout).returns(1)
|
@@ -111,7 +111,7 @@ module Beetle
|
|
111
111
|
end
|
112
112
|
end
|
113
113
|
|
114
|
-
class GarbageCollectionTest <
|
114
|
+
class GarbageCollectionTest < MiniTest::Unit::TestCase
|
115
115
|
def setup
|
116
116
|
@store = DeduplicationStore.new
|
117
117
|
Beetle.config.stubs(:gc_threshold).returns(10)
|
data/test/beetle/handler_test.rb
CHANGED
data/test/beetle/message_test.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
|
3
3
|
|
4
4
|
module Beetle
|
5
5
|
|
6
|
-
class EncodingTest <
|
6
|
+
class EncodingTest < MiniTest::Unit::TestCase
|
7
7
|
test "an exception during decoding should be stored in the exception attribute" do
|
8
8
|
header = stub_everything("raising header")
|
9
9
|
m = Message.new("queue", header, 'foo')
|
@@ -69,7 +69,7 @@ module Beetle
|
|
69
69
|
|
70
70
|
end
|
71
71
|
|
72
|
-
class KeyManagementTest <
|
72
|
+
class KeyManagementTest < MiniTest::Unit::TestCase
|
73
73
|
def setup
|
74
74
|
@store = DeduplicationStore.new
|
75
75
|
@store.flushdb
|
@@ -164,7 +164,7 @@ module Beetle
|
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
167
|
-
class AckingTest <
|
167
|
+
class AckingTest < MiniTest::Unit::TestCase
|
168
168
|
|
169
169
|
def setup
|
170
170
|
@store = DeduplicationStore.new
|
@@ -238,7 +238,7 @@ module Beetle
|
|
238
238
|
|
239
239
|
end
|
240
240
|
|
241
|
-
class FreshMessageTest <
|
241
|
+
class FreshMessageTest < MiniTest::Unit::TestCase
|
242
242
|
def setup
|
243
243
|
@store = DeduplicationStore.new
|
244
244
|
@store.flushdb
|
@@ -273,7 +273,7 @@ module Beetle
|
|
273
273
|
|
274
274
|
end
|
275
275
|
|
276
|
-
class SimpleMessageTest <
|
276
|
+
class SimpleMessageTest < MiniTest::Unit::TestCase
|
277
277
|
def setup
|
278
278
|
@store = DeduplicationStore.new
|
279
279
|
@store.flushdb
|
@@ -307,7 +307,7 @@ module Beetle
|
|
307
307
|
|
308
308
|
end
|
309
309
|
|
310
|
-
class HandlerCrashTest <
|
310
|
+
class HandlerCrashTest < MiniTest::Unit::TestCase
|
311
311
|
def setup
|
312
312
|
@store = DeduplicationStore.new
|
313
313
|
@store.flushdb
|
@@ -380,7 +380,7 @@ module Beetle
|
|
380
380
|
|
381
381
|
end
|
382
382
|
|
383
|
-
class SeenMessageTest <
|
383
|
+
class SeenMessageTest < MiniTest::Unit::TestCase
|
384
384
|
def setup
|
385
385
|
@store = DeduplicationStore.new
|
386
386
|
@store.flushdb
|
@@ -526,7 +526,7 @@ module Beetle
|
|
526
526
|
|
527
527
|
end
|
528
528
|
|
529
|
-
class ProcessingTest <
|
529
|
+
class ProcessingTest < MiniTest::Unit::TestCase
|
530
530
|
def setup
|
531
531
|
@store = DeduplicationStore.new
|
532
532
|
@store.flushdb
|
@@ -594,7 +594,7 @@ module Beetle
|
|
594
594
|
|
595
595
|
end
|
596
596
|
|
597
|
-
class HandlerTimeoutTest <
|
597
|
+
class HandlerTimeoutTest < MiniTest::Unit::TestCase
|
598
598
|
def setup
|
599
599
|
@store = DeduplicationStore.new
|
600
600
|
@store.flushdb
|
@@ -622,7 +622,7 @@ module Beetle
|
|
622
622
|
|
623
623
|
end
|
624
624
|
|
625
|
-
class SettingsTest <
|
625
|
+
class SettingsTest < MiniTest::Unit::TestCase
|
626
626
|
def setup
|
627
627
|
@store = DeduplicationStore.new
|
628
628
|
@store.flushdb
|
@@ -775,7 +775,7 @@ module Beetle
|
|
775
775
|
end
|
776
776
|
|
777
777
|
|
778
|
-
class RoutingKeyTest <
|
778
|
+
class RoutingKeyTest < MiniTest::Unit::TestCase
|
779
779
|
test "returns the routing key" do
|
780
780
|
header = header_with_params({})
|
781
781
|
header.stubs(:routing_key).returns("foo")
|
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
|
2
2
|
|
3
3
|
|
4
4
|
module Beetle
|
5
|
-
class PublisherTest <
|
5
|
+
class PublisherTest < MiniTest::Unit::TestCase
|
6
6
|
def setup
|
7
7
|
client = Client.new
|
8
8
|
@pub = Publisher.new(client)
|
@@ -46,7 +46,7 @@ module Beetle
|
|
46
46
|
|
47
47
|
end
|
48
48
|
|
49
|
-
class PublisherPublishingTest <
|
49
|
+
class PublisherPublishingTest < MiniTest::Unit::TestCase
|
50
50
|
def setup
|
51
51
|
@client = Client.new
|
52
52
|
@pub = Publisher.new(@client)
|
@@ -212,7 +212,7 @@ module Beetle
|
|
212
212
|
|
213
213
|
end
|
214
214
|
|
215
|
-
class PublisherQueueManagementTest <
|
215
|
+
class PublisherQueueManagementTest < MiniTest::Unit::TestCase
|
216
216
|
def setup
|
217
217
|
@client = Client.new
|
218
218
|
@pub = Publisher.new(@client)
|
@@ -278,7 +278,7 @@ module Beetle
|
|
278
278
|
end
|
279
279
|
end
|
280
280
|
|
281
|
-
class PublisherExchangeManagementTest <
|
281
|
+
class PublisherExchangeManagementTest < MiniTest::Unit::TestCase
|
282
282
|
def setup
|
283
283
|
@client = Client.new
|
284
284
|
@pub = Publisher.new(@client)
|
@@ -300,7 +300,7 @@ module Beetle
|
|
300
300
|
end
|
301
301
|
end
|
302
302
|
|
303
|
-
class PublisherServerManagementTest <
|
303
|
+
class PublisherServerManagementTest < MiniTest::Unit::TestCase
|
304
304
|
def setup
|
305
305
|
@client = Client.new
|
306
306
|
@pub = Publisher.new(@client)
|
@@ -377,7 +377,7 @@ module Beetle
|
|
377
377
|
end
|
378
378
|
|
379
379
|
|
380
|
-
class RPCTest <
|
380
|
+
class RPCTest < MiniTest::Unit::TestCase
|
381
381
|
def setup
|
382
382
|
@client = Client.new
|
383
383
|
@pub = Publisher.new(@client)
|
data/test/beetle/r_c_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
2
|
|
3
3
|
module Beetle
|
4
|
-
class ReturnCodesTest <
|
4
|
+
class ReturnCodesTest < MiniTest::Unit::TestCase
|
5
5
|
test "inspecting a return code should display the name of the returncode" do
|
6
6
|
assert_equal "Beetle::RC::OK", Beetle::RC::OK.inspect
|
7
7
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
2
|
|
3
3
|
module Beetle
|
4
|
-
class RedisConfigurationClientTest <
|
4
|
+
class RedisConfigurationClientTest < MiniTest::Unit::TestCase
|
5
5
|
def setup
|
6
6
|
Beetle.config.redis_servers = "redis:0,redis:1"
|
7
7
|
@client = RedisConfigurationClient.new
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
2
|
|
3
3
|
module Beetle
|
4
|
-
class RedisConfigurationServerTest <
|
4
|
+
class RedisConfigurationServerTest < MiniTest::Unit::TestCase
|
5
5
|
def setup
|
6
6
|
Beetle.config.redis_configuration_client_ids = "rc-client-1,rc-client-2"
|
7
7
|
@server = RedisConfigurationServer.new
|
@@ -10,7 +10,7 @@ module Beetle
|
|
10
10
|
|
11
11
|
test "should exit when started with less than two redis configured" do
|
12
12
|
Beetle.config.redis_servers = ""
|
13
|
-
|
13
|
+
assert_raises Beetle::ConfigurationError do
|
14
14
|
@server.start
|
15
15
|
end
|
16
16
|
end
|
@@ -87,7 +87,7 @@ module Beetle
|
|
87
87
|
|
88
88
|
end
|
89
89
|
|
90
|
-
class RedisConfigurationServerInvalidationTest <
|
90
|
+
class RedisConfigurationServerInvalidationTest < MiniTest::Unit::TestCase
|
91
91
|
def setup
|
92
92
|
Beetle.config.redis_configuration_client_ids = "rc-client-1,rc-client-2"
|
93
93
|
Beetle.config.redis_servers = "redis:0,redis:1"
|
@@ -175,7 +175,7 @@ module Beetle
|
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
|
-
class RedisConfigurationServerInitialRedisMasterDeterminationTest <
|
178
|
+
class RedisConfigurationServerInitialRedisMasterDeterminationTest < MiniTest::Unit::TestCase
|
179
179
|
def setup
|
180
180
|
EM::Timer.stubs(:new).returns(true)
|
181
181
|
EventMachine.stubs(:add_periodic_timer).yields
|
@@ -303,7 +303,7 @@ module Beetle
|
|
303
303
|
end
|
304
304
|
end
|
305
305
|
|
306
|
-
class RedisConfigurationServerSystemNotificationTest <
|
306
|
+
class RedisConfigurationServerSystemNotificationTest < MiniTest::Unit::TestCase
|
307
307
|
def setup
|
308
308
|
Beetle.config.redis_configuration_client_ids = "rc-client-1,rc-client-2"
|
309
309
|
@server = RedisConfigurationServer.new
|
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
|
2
2
|
|
3
3
|
module Beetle
|
4
4
|
|
5
|
-
class NonExistentRedisTest <
|
5
|
+
class NonExistentRedisTest < MiniTest::Unit::TestCase
|
6
6
|
def setup
|
7
7
|
@r = Redis.new(:host => "localhost", :port => 6390)
|
8
8
|
end
|
@@ -33,7 +33,7 @@ module Beetle
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
class AddedRedisMethodsTest <
|
36
|
+
class AddedRedisMethodsTest < MiniTest::Unit::TestCase
|
37
37
|
def setup
|
38
38
|
@r = Redis.new(:host => "localhost", :port => 6390)
|
39
39
|
end
|
@@ -55,13 +55,13 @@ module Beetle
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
class HiredisLoadedTest <
|
58
|
+
class HiredisLoadedTest < MiniTest::Unit::TestCase
|
59
59
|
test "should be using hiredis instead of the redis ruby backend" do
|
60
60
|
assert defined?(Hiredis)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
class RedisShutdownTest <
|
64
|
+
class RedisShutdownTest < MiniTest::Unit::TestCase
|
65
65
|
def setup
|
66
66
|
@r = Redis.new(:host => "localhost", :port => 6390)
|
67
67
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
2
|
|
3
3
|
module Beetle
|
4
|
-
class SubscriberTest <
|
4
|
+
class SubscriberTest < MiniTest::Unit::TestCase
|
5
5
|
def setup
|
6
6
|
client = Client.new
|
7
7
|
@sub = client.send(:subscriber)
|
@@ -47,7 +47,7 @@ module Beetle
|
|
47
47
|
|
48
48
|
end
|
49
49
|
|
50
|
-
class SubscriberPauseAndResumeTest <
|
50
|
+
class SubscriberPauseAndResumeTest < MiniTest::Unit::TestCase
|
51
51
|
def setup
|
52
52
|
@client = Client.new
|
53
53
|
@sub = @client.send(:subscriber)
|
@@ -116,7 +116,7 @@ module Beetle
|
|
116
116
|
|
117
117
|
end
|
118
118
|
|
119
|
-
class AdditionalSubscriptionServersTest <
|
119
|
+
class AdditionalSubscriptionServersTest < MiniTest::Unit::TestCase
|
120
120
|
def setup
|
121
121
|
@config = Configuration.new
|
122
122
|
@config.additional_subscription_servers = "localhost:1234"
|
@@ -129,7 +129,7 @@ module Beetle
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
class SubscriberQueueManagementTest <
|
132
|
+
class SubscriberQueueManagementTest < MiniTest::Unit::TestCase
|
133
133
|
def setup
|
134
134
|
@client = Client.new
|
135
135
|
@sub = @client.send(:subscriber)
|
@@ -186,7 +186,7 @@ module Beetle
|
|
186
186
|
|
187
187
|
end
|
188
188
|
|
189
|
-
class SubscriberExchangeManagementTest <
|
189
|
+
class SubscriberExchangeManagementTest < MiniTest::Unit::TestCase
|
190
190
|
def setup
|
191
191
|
@client = Client.new
|
192
192
|
@sub = @client.send(:subscriber)
|
@@ -218,7 +218,7 @@ module Beetle
|
|
218
218
|
end
|
219
219
|
end
|
220
220
|
|
221
|
-
class CallBackExecutionTest <
|
221
|
+
class CallBackExecutionTest < MiniTest::Unit::TestCase
|
222
222
|
def setup
|
223
223
|
client = Client.new
|
224
224
|
@queue = "somequeue"
|
@@ -283,7 +283,7 @@ module Beetle
|
|
283
283
|
|
284
284
|
end
|
285
285
|
|
286
|
-
class SubscriptionTest <
|
286
|
+
class SubscriptionTest < MiniTest::Unit::TestCase
|
287
287
|
def setup
|
288
288
|
@client = Client.new
|
289
289
|
@sub = @client.send(:subscriber)
|
@@ -334,7 +334,7 @@ module Beetle
|
|
334
334
|
end
|
335
335
|
end
|
336
336
|
|
337
|
-
class HandlersTest <
|
337
|
+
class HandlersTest < MiniTest::Unit::TestCase
|
338
338
|
def setup
|
339
339
|
@client = Client.new
|
340
340
|
@sub = @client.send(:subscriber)
|
@@ -354,7 +354,7 @@ module Beetle
|
|
354
354
|
|
355
355
|
end
|
356
356
|
|
357
|
-
class ConnectionTest <
|
357
|
+
class ConnectionTest < MiniTest::Unit::TestCase
|
358
358
|
def setup
|
359
359
|
@client = Client.new
|
360
360
|
@sub = @client.send(:subscriber)
|
data/test/test_helper.rb
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
add_filter "/lib/beetle/redis_ext.rb"
|
7
|
-
end
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter "/test/"
|
5
|
+
add_filter "/lib/beetle/redis_ext.rb"
|
8
6
|
end
|
9
|
-
|
7
|
+
|
8
|
+
require 'minitest/autorun'
|
9
|
+
require 'minitest/unit'
|
10
|
+
require 'minitest/pride' if ENV['RAINBOW_COLORED_TESTS'] == "1" && $stdout.tty?
|
10
11
|
require 'mocha/setup'
|
11
|
-
require 'active_support/testing/declarative'
|
12
12
|
|
13
13
|
require File.expand_path(File.dirname(__FILE__) + '/../lib/beetle')
|
14
|
-
require File.expand_path(File.dirname(__FILE__) + '/colorized_test_output')
|
15
14
|
|
16
|
-
class
|
15
|
+
class MiniTest::Unit::TestCase
|
16
|
+
require "active_support/testing/declarative"
|
17
17
|
extend ActiveSupport::Testing::Declarative
|
18
|
+
def assert_nothing_raised(*)
|
19
|
+
yield
|
20
|
+
end
|
18
21
|
end
|
19
22
|
|
20
23
|
I18n.enforce_available_locales = false
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beetle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Kaes
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-05-
|
15
|
+
date: 2014-05-26 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: uuid4r
|
@@ -191,7 +191,6 @@ files:
|
|
191
191
|
- examples/redundant.rb
|
192
192
|
- examples/rpc.rb
|
193
193
|
- examples/simple.rb
|
194
|
-
- examples/test_publisher.rb
|
195
194
|
- features/README.rdoc
|
196
195
|
- features/redis_auto_failover.feature
|
197
196
|
- features/step_definitions/redis_auto_failover_steps.rb
|
@@ -242,7 +241,6 @@ files:
|
|
242
241
|
- test/beetle/redis_master_file_test.rb
|
243
242
|
- test/beetle/subscriber_test.rb
|
244
243
|
- test/beetle_test.rb
|
245
|
-
- test/colorized_test_output.rb
|
246
244
|
- test/test_helper.rb
|
247
245
|
homepage: http://xing.github.com/beetle/
|
248
246
|
licenses: []
|
@@ -285,5 +283,4 @@ test_files:
|
|
285
283
|
- test/beetle/redis_master_file_test.rb
|
286
284
|
- test/beetle/subscriber_test.rb
|
287
285
|
- test/beetle_test.rb
|
288
|
-
- test/colorized_test_output.rb
|
289
286
|
- test/test_helper.rb
|
data/examples/test_publisher.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# attempts.rb
|
2
|
-
# this example shows you how to use the exception limiting feature of beetle
|
3
|
-
# it allows you to control the number of retries your handler will go through
|
4
|
-
# with one message before giving up on it
|
5
|
-
#
|
6
|
-
# ! check the examples/README.rdoc for information on starting your redis/rabbit !
|
7
|
-
#
|
8
|
-
# start it with ruby attempts.rb
|
9
|
-
|
10
|
-
require "rubygems"
|
11
|
-
require File.expand_path("../lib/beetle", File.dirname(__FILE__))
|
12
|
-
require "eventmachine"
|
13
|
-
|
14
|
-
# set Beetle log level to info, less noisy than debug
|
15
|
-
Beetle.config.logger.level = Logger::INFO
|
16
|
-
|
17
|
-
# setup client
|
18
|
-
client = Beetle::Client.new
|
19
|
-
client.register_message(:test)
|
20
|
-
|
21
|
-
n = 0
|
22
|
-
EM.run do
|
23
|
-
EM.add_periodic_timer(0.1) do
|
24
|
-
data = (n+=1)
|
25
|
-
client.logger.info "publishing #{data}"
|
26
|
-
client.publish(:test, data)
|
27
|
-
end
|
28
|
-
trap("INT") do
|
29
|
-
client.stop_publishing
|
30
|
-
EM.stop_event_loop
|
31
|
-
end
|
32
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# colorized output for Test::Unit / MiniTest
|
2
|
-
begin
|
3
|
-
if RUBY_VERSION < "1.9"
|
4
|
-
require 'redgreen'
|
5
|
-
else
|
6
|
-
module ColorizedDots
|
7
|
-
require 'ansi/code'
|
8
|
-
def run(runner)
|
9
|
-
r = super
|
10
|
-
ANSI.ansi(r, ANSI_COLOR_MAPPING[r])
|
11
|
-
end
|
12
|
-
ANSI_COLOR_MAPPING = Hash.new(:white).merge!('.' => :green, 'S' => :magenta, 'F' => :yellow, 'E' => :red )
|
13
|
-
end
|
14
|
-
class MiniTest::Unit
|
15
|
-
TestCase.send(:include, ColorizedDots)
|
16
|
-
def status(io = @@out)
|
17
|
-
format = "%d tests, %d assertions, %d failures, %d errors, %d skips"
|
18
|
-
color = (errors + failures) > 0 ? :red : :green
|
19
|
-
io.puts ANSI.ansi(format % [test_count, assertion_count, failures, errors, skips], color)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
rescue LoadError => e
|
24
|
-
# do nothing
|
25
|
-
end if $stdout.tty?
|