fluent-plugin-mongo 0.7.16 → 0.8.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/VERSION +1 -1
- data/bin/mongo-tail +37 -30
- data/fluent-plugin-mongo.gemspec +1 -1
- data/lib/fluent/plugin/in_mongo_tail.rb +122 -138
- data/lib/fluent/plugin/logger_support.rb +25 -0
- data/lib/fluent/plugin/mongo_auth.rb +32 -0
- data/lib/fluent/plugin/out_mongo.rb +83 -136
- data/lib/fluent/plugin/out_mongo_replset.rb +20 -31
- data/test/helper.rb +6 -0
- data/test/plugin/test_in_mongo_tail.rb +96 -0
- data/test/plugin/test_out_mongo.rb +282 -0
- data/test/plugin/test_out_mongo_replset.rb +125 -0
- metadata +16 -22
- data/lib/fluent/plugin/mongo_util.rb +0 -27
- data/lib/fluent/plugin/out_mongo_tag_collection.rb +0 -20
- data/test/plugin/in_mongo_tail.rb +0 -73
- data/test/plugin/out_mongo.rb +0 -298
- data/test/plugin/out_mongo_tag_mapped.rb +0 -69
- data/test/test_helper.rb +0 -59
- data/test/tools/auth_repl_set_manager.rb +0 -14
- data/test/tools/repl_set_manager.rb +0 -420
- data/test/tools/rs_test_helper.rb +0 -39
@@ -1,39 +0,0 @@
|
|
1
|
-
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
require 'test_helper'
|
3
|
-
require 'tools/repl_set_manager'
|
4
|
-
|
5
|
-
class Test::Unit::TestCase
|
6
|
-
# Ensure replica set is available as an instance variable and that
|
7
|
-
# a new set is spun up for each TestCase class
|
8
|
-
def self.setup_rs
|
9
|
-
@@rs = ReplSetManager.new
|
10
|
-
@@rs.start_set
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.teardown_rs
|
14
|
-
@@rs.cleanup_set
|
15
|
-
end
|
16
|
-
|
17
|
-
# Generic code for rescuing connection failures and retrying operations.
|
18
|
-
# This could be combined with some timeout functionality.
|
19
|
-
def rescue_connection_failure(max_retries=30)
|
20
|
-
retries = 0
|
21
|
-
begin
|
22
|
-
yield
|
23
|
-
rescue Mongo::ConnectionFailure => ex
|
24
|
-
puts "Rescue attempt #{retries}: from #{ex}"
|
25
|
-
retries += 1
|
26
|
-
raise ex if retries > max_retries
|
27
|
-
sleep(2)
|
28
|
-
retry
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def build_seeds(num_hosts)
|
33
|
-
seeds = []
|
34
|
-
num_hosts.times do |n|
|
35
|
-
seeds << "#{@@rs.host}:#{@@rs.ports[n]}"
|
36
|
-
end
|
37
|
-
seeds
|
38
|
-
end
|
39
|
-
end
|