fluent-plugin-gcloud-pubsub-custom 0.4.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +5 -0
- data/fluent-plugin-gcloud-pubsub-custom.gemspec +2 -2
- data/lib/fluent/plugin/in_gcloud_pubsub.rb +16 -24
- data/lib/fluent/plugin/out_gcloud_pubsub.rb +21 -15
- data/test/plugin/test_in_gcloud_pubsub.rb +40 -57
- data/test/plugin/test_out_gcloud_pubsub.rb +29 -18
- metadata +4 -5
- data/Gemfile.v0.12 +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 576bd9856edc014e5c0927f90e615c0405df6651
|
4
|
+
data.tar.gz: 9b1ba5307adcc19b8e996925e0fc0b2b967b2465
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c2998193aa348ffa5bc5b5a1f77d5965e91e2dca4df536e69e4554a976071dfe65d74aa324587b09febd984aa8daf8f13bf28bffcec95d1bf6003cb96a91bbc
|
7
|
+
data.tar.gz: 2a9b00f9aadc38cf51af96c49812eaacee60f43f2f15b5e11eb719f04795a818013c81948970df206b22356f95268b59b6046ca01e74696ddef4469fd0578b64
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.license = "MIT"
|
8
8
|
gem.homepage = "https://github.com/mia-0032/fluent-plugin-gcloud-pubsub-custom"
|
9
9
|
gem.summary = gem.description
|
10
|
-
gem.version = "0.
|
10
|
+
gem.version = "1.0.0"
|
11
11
|
gem.authors = ["Yoshihiro MIYAI"]
|
12
12
|
gem.email = "msparrow17@gmail.com"
|
13
13
|
gem.has_rdoc = false
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
17
|
gem.require_paths = ['lib']
|
18
18
|
|
19
|
-
gem.add_runtime_dependency "fluentd", [">= 0.
|
19
|
+
gem.add_runtime_dependency "fluentd", [">= 0.14.15", "< 2"]
|
20
20
|
gem.add_runtime_dependency "google-cloud-pubsub", "~> 0.24.0"
|
21
21
|
gem.add_runtime_dependency "retryable", "~> 2.0"
|
22
22
|
|
@@ -1,21 +1,18 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'webrick'
|
3
3
|
|
4
|
-
require 'fluent/input'
|
5
|
-
require 'fluent/parser'
|
4
|
+
require 'fluent/plugin/input'
|
5
|
+
require 'fluent/plugin/parser'
|
6
6
|
|
7
7
|
require 'fluent/plugin/gcloud_pubsub/client'
|
8
8
|
|
9
|
-
module Fluent
|
9
|
+
module Fluent::Plugin
|
10
10
|
class GcloudPubSubInput < Input
|
11
11
|
Fluent::Plugin.register_input('gcloud_pubsub', self)
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
13
|
+
helpers :compat_parameters, :parser, :thread
|
14
|
+
|
15
|
+
DEFAULT_PARSER_TYPE = 'json'
|
19
16
|
|
20
17
|
class FailedParseError < StandardError
|
21
18
|
end
|
@@ -41,7 +38,7 @@ module Fluent
|
|
41
38
|
desc 'Set number of threads to pull messages.'
|
42
39
|
config_param :pull_threads, :integer, default: 1
|
43
40
|
desc 'Set input format.'
|
44
|
-
config_param :format, :string, default:
|
41
|
+
config_param :format, :string, default: DEFAULT_PARSER_TYPE
|
45
42
|
desc 'Set error type when parsing messages fails.'
|
46
43
|
config_param :parse_error_action, :enum, default: :exception, list: [:exception, :warning]
|
47
44
|
# for HTTP RPC
|
@@ -52,12 +49,8 @@ module Fluent
|
|
52
49
|
desc 'Port for HTTP RPC.'
|
53
50
|
config_param :rpc_port, :integer, default: 24680
|
54
51
|
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
unless method_defined?(:router)
|
60
|
-
define_method("router") { Fluent::Engine }
|
52
|
+
config_section :parse do
|
53
|
+
config_set_default :@type, DEFAULT_PARSER_TYPE
|
61
54
|
end
|
62
55
|
|
63
56
|
class RPCServlet < WEBrick::HTTPServlet::AbstractServlet
|
@@ -108,6 +101,7 @@ module Fluent
|
|
108
101
|
end
|
109
102
|
|
110
103
|
def configure(conf)
|
104
|
+
compat_parameters_convert(conf, :parser)
|
111
105
|
super
|
112
106
|
@rpc_srv = nil
|
113
107
|
@rpc_thread = nil
|
@@ -119,8 +113,7 @@ module Fluent
|
|
119
113
|
method(:dynamic_tag)
|
120
114
|
end
|
121
115
|
|
122
|
-
@parser =
|
123
|
-
@parser.configure(conf)
|
116
|
+
@parser = parser_create
|
124
117
|
end
|
125
118
|
|
126
119
|
def start
|
@@ -133,23 +126,22 @@ module Fluent
|
|
133
126
|
@emit_guard = Mutex.new
|
134
127
|
@stop_subscribing = false
|
135
128
|
@subscribe_threads = []
|
136
|
-
@pull_threads.times do
|
137
|
-
@subscribe_threads.push
|
129
|
+
@pull_threads.times do |idx|
|
130
|
+
@subscribe_threads.push thread_create("in_gcloud_pubsub_subscribe_#{idx}".to_sym, &method(:subscribe))
|
138
131
|
end
|
139
132
|
end
|
140
133
|
|
141
134
|
def shutdown
|
142
|
-
super
|
143
135
|
if @rpc_srv
|
144
136
|
@rpc_srv.shutdown
|
145
137
|
@rpc_srv = nil
|
146
138
|
end
|
147
139
|
if @rpc_thread
|
148
|
-
@rpc_thread.join
|
149
140
|
@rpc_thread = nil
|
150
141
|
end
|
151
142
|
@stop_subscribing = true
|
152
143
|
@subscribe_threads.each(&:join)
|
144
|
+
super
|
153
145
|
end
|
154
146
|
|
155
147
|
def stop_pull
|
@@ -187,7 +179,7 @@ module Fluent
|
|
187
179
|
}
|
188
180
|
)
|
189
181
|
@rpc_srv.mount('/api/in_gcloud_pubsub/pull/', RPCServlet, self)
|
190
|
-
@rpc_thread =
|
182
|
+
@rpc_thread = thread_create(:in_gcloud_pubsub_rpc_thread){
|
191
183
|
@rpc_srv.start
|
192
184
|
}
|
193
185
|
end
|
@@ -225,7 +217,7 @@ module Fluent
|
|
225
217
|
|
226
218
|
def process(messages)
|
227
219
|
event_streams = Hash.new do |hsh, key|
|
228
|
-
hsh[key] = MultiEventStream.new
|
220
|
+
hsh[key] = Fluent::MultiEventStream.new
|
229
221
|
end
|
230
222
|
|
231
223
|
messages.each do |m|
|
@@ -1,17 +1,15 @@
|
|
1
|
-
require 'fluent/output'
|
1
|
+
require 'fluent/plugin/output'
|
2
2
|
|
3
3
|
require 'fluent/plugin/gcloud_pubsub/client'
|
4
4
|
|
5
|
-
module Fluent
|
6
|
-
class GcloudPubSubOutput <
|
5
|
+
module Fluent::Plugin
|
6
|
+
class GcloudPubSubOutput < Output
|
7
7
|
Fluent::Plugin.register_output('gcloud_pubsub', self)
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
9
|
+
helpers :compat_parameters, :formatter
|
10
|
+
|
11
|
+
DEFAULT_BUFFER_TYPE = "memory"
|
12
|
+
DEFAULT_FORMATTER_TYPE = "json"
|
15
13
|
|
16
14
|
desc 'Set your GCP project.'
|
17
15
|
config_param :project, :string, :default => nil
|
@@ -30,18 +28,18 @@ module Fluent
|
|
30
28
|
desc 'Set output format.'
|
31
29
|
config_param :format, :string, :default => 'json'
|
32
30
|
|
33
|
-
|
34
|
-
|
31
|
+
config_section :buffer do
|
32
|
+
config_set_default :@type, DEFAULT_BUFFER_TYPE
|
35
33
|
end
|
36
34
|
|
37
|
-
|
38
|
-
|
35
|
+
config_section :format do
|
36
|
+
config_set_default :@type, DEFAULT_FORMATTER_TYPE
|
39
37
|
end
|
40
38
|
|
41
39
|
def configure(conf)
|
40
|
+
compat_parameters_convert(conf, :buffer, :formatter)
|
42
41
|
super
|
43
|
-
@formatter =
|
44
|
-
@formatter.configure(conf)
|
42
|
+
@formatter = formatter_create
|
45
43
|
end
|
46
44
|
|
47
45
|
def start
|
@@ -54,6 +52,14 @@ module Fluent
|
|
54
52
|
@formatter.format(tag, time, record).to_msgpack
|
55
53
|
end
|
56
54
|
|
55
|
+
def formatted_to_msgpack_binary?
|
56
|
+
true
|
57
|
+
end
|
58
|
+
|
59
|
+
def multi_workers_ready?
|
60
|
+
true
|
61
|
+
end
|
62
|
+
|
57
63
|
def write(chunk)
|
58
64
|
messages = []
|
59
65
|
size = 0
|
@@ -2,6 +2,7 @@ require 'net/http'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
require_relative "../test_helper"
|
5
|
+
require "fluent/test/driver/input"
|
5
6
|
|
6
7
|
class GcloudPubSubInputTest < Test::Unit::TestCase
|
7
8
|
CONFIG = %[
|
@@ -29,7 +30,7 @@ class GcloudPubSubInputTest < Test::Unit::TestCase
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def create_driver(conf=CONFIG)
|
32
|
-
Fluent::Test::
|
33
|
+
Fluent::Test::Driver::Input.new(Fluent::Plugin::GcloudPubSubInput).configure(conf)
|
33
34
|
end
|
34
35
|
|
35
36
|
def http_get(path)
|
@@ -164,27 +165,23 @@ class GcloudPubSubInputTest < Test::Unit::TestCase
|
|
164
165
|
end
|
165
166
|
|
166
167
|
test 'empty' do
|
167
|
-
@subscriber.pull(immediate: true, max: 100).
|
168
|
+
@subscriber.pull(immediate: true, max: 100).at_least(1) { [] }
|
168
169
|
@subscriber.acknowledge.times(0)
|
169
170
|
|
170
171
|
d = create_driver
|
171
|
-
d.run
|
172
|
-
# d.run sleeps 0.5 sec
|
173
|
-
}
|
172
|
+
d.run(expect_emits: 1, timeout: 3)
|
174
173
|
|
175
|
-
|
174
|
+
assert_true d.events.empty?
|
176
175
|
end
|
177
176
|
|
178
177
|
test 'simple' do
|
179
178
|
messages = Array.new(1, DummyMessage.new)
|
180
|
-
@subscriber.pull(immediate: true, max: 100).
|
179
|
+
@subscriber.pull(immediate: true, max: 100).at_least(1) { messages }
|
181
180
|
@subscriber.acknowledge(messages).once
|
182
181
|
|
183
182
|
d = create_driver
|
184
|
-
d.run
|
185
|
-
|
186
|
-
}
|
187
|
-
emits = d.emits
|
183
|
+
d.run(expect_emits: 1, timeout: 3)
|
184
|
+
emits = d.events
|
188
185
|
|
189
186
|
assert_equal(1, emits.length)
|
190
187
|
emits.each do |tag, time, record|
|
@@ -195,16 +192,14 @@ class GcloudPubSubInputTest < Test::Unit::TestCase
|
|
195
192
|
|
196
193
|
test 'multithread' do
|
197
194
|
messages = Array.new(1, DummyMessage.new)
|
198
|
-
@subscriber.pull(immediate: true, max: 100).
|
199
|
-
@subscriber.acknowledge(messages).
|
195
|
+
@subscriber.pull(immediate: true, max: 100).at_least(2) { messages }
|
196
|
+
@subscriber.acknowledge(messages).at_least(2)
|
200
197
|
|
201
198
|
d = create_driver("#{CONFIG}\npull_threads 2")
|
202
|
-
d.run
|
203
|
-
|
204
|
-
}
|
205
|
-
emits = d.emits
|
199
|
+
d.run(expect_emits: 2, timeout: 1)
|
200
|
+
emits = d.events
|
206
201
|
|
207
|
-
|
202
|
+
assert(2 <= emits.length)
|
208
203
|
emits.each do |tag, time, record|
|
209
204
|
assert_equal("test", tag)
|
210
205
|
assert_equal({"foo" => "bar"}, record)
|
@@ -217,14 +212,12 @@ class GcloudPubSubInputTest < Test::Unit::TestCase
|
|
217
212
|
DummyMessageWithTagKey.new('tag2'),
|
218
213
|
DummyMessage.new
|
219
214
|
]
|
220
|
-
@subscriber.pull(immediate: true, max: 100).
|
215
|
+
@subscriber.pull(immediate: true, max: 100).at_least(1) { messages }
|
221
216
|
@subscriber.acknowledge(messages).once
|
222
217
|
|
223
218
|
d = create_driver("#{CONFIG}\ntag_key test_tag_key")
|
224
|
-
d.run
|
225
|
-
|
226
|
-
}
|
227
|
-
emits = d.emits
|
219
|
+
d.run(expect_emits: 1, timeout: 3)
|
220
|
+
emits = d.events
|
228
221
|
|
229
222
|
assert_equal(3, emits.length)
|
230
223
|
# test tag
|
@@ -239,69 +232,59 @@ class GcloudPubSubInputTest < Test::Unit::TestCase
|
|
239
232
|
|
240
233
|
test 'invalid messages with parse_error_action exception ' do
|
241
234
|
messages = Array.new(1, DummyInvalidMessage.new)
|
242
|
-
@subscriber.pull(immediate: true, max: 100).
|
235
|
+
@subscriber.pull(immediate: true, max: 100).at_least(1) { messages }
|
243
236
|
@subscriber.acknowledge.times(0)
|
244
237
|
|
245
238
|
d = create_driver
|
246
|
-
d.run
|
247
|
-
|
248
|
-
}
|
249
|
-
assert_equal(true, d.emits.empty?)
|
239
|
+
d.run(expect_emits: 1, timeout: 3)
|
240
|
+
assert_true d.events.empty?
|
250
241
|
end
|
251
242
|
|
252
243
|
test 'invalid messages with parse_error_action warning' do
|
253
244
|
messages = Array.new(1, DummyInvalidMessage.new)
|
254
|
-
@subscriber.pull(immediate: true, max: 100).
|
255
|
-
@subscriber.acknowledge(messages).
|
245
|
+
@subscriber.pull(immediate: true, max: 100).at_least(1) { messages }
|
246
|
+
@subscriber.acknowledge(messages).at_least(1)
|
256
247
|
|
257
248
|
d = create_driver("#{CONFIG}\nparse_error_action warning")
|
258
|
-
d.run
|
259
|
-
|
260
|
-
}
|
261
|
-
assert_equal(true, d.emits.empty?)
|
249
|
+
d.run(expect_emits: 1, timeout: 3)
|
250
|
+
assert_true d.events.empty?
|
262
251
|
end
|
263
252
|
|
264
253
|
test 'retry if raised error' do
|
265
254
|
class UnknownError < StandardError
|
266
255
|
end
|
267
|
-
@subscriber.pull(immediate: true, max: 100).
|
256
|
+
@subscriber.pull(immediate: true, max: 100).at_least(2) { raise UnknownError.new('test') }
|
268
257
|
@subscriber.acknowledge.times(0)
|
269
258
|
|
270
259
|
d = create_driver(CONFIG + 'pull_interval 0.5')
|
271
|
-
d.run
|
272
|
-
sleep 0.1 # + 0.5s
|
273
|
-
}
|
260
|
+
d.run(expect_emits: 1, timeout: 0.8)
|
274
261
|
|
275
262
|
assert_equal(0.5, d.instance.pull_interval)
|
276
|
-
|
263
|
+
assert_true d.events.empty?
|
277
264
|
end
|
278
265
|
|
279
266
|
test 'retry if raised RetryableError on pull' do
|
280
|
-
@subscriber.pull(immediate: true, max: 100).
|
267
|
+
@subscriber.pull(immediate: true, max: 100).at_least(2) { raise Google::Cloud::UnavailableError.new('TEST') }
|
281
268
|
@subscriber.acknowledge.times(0)
|
282
269
|
|
283
270
|
d = create_driver("#{CONFIG}\npull_interval 0.5")
|
284
|
-
d.run
|
285
|
-
sleep 0.1 # + 0.5s
|
286
|
-
}
|
271
|
+
d.run(expect_emits: 1, timeout: 0.8)
|
287
272
|
|
288
273
|
assert_equal(0.5, d.instance.pull_interval)
|
289
|
-
|
274
|
+
assert_true d.events.empty?
|
290
275
|
end
|
291
276
|
|
292
277
|
test 'retry if raised RetryableError on acknowledge' do
|
293
278
|
messages = Array.new(1, DummyMessage.new)
|
294
|
-
@subscriber.pull(immediate: true, max: 100).
|
279
|
+
@subscriber.pull(immediate: true, max: 100).at_least(2) { messages }
|
295
280
|
@subscriber.acknowledge(messages).twice { raise Google::Cloud::UnavailableError.new('TEST') }
|
296
281
|
|
297
282
|
d = create_driver("#{CONFIG}\npull_interval 0.5")
|
298
|
-
d.run
|
299
|
-
|
300
|
-
}
|
301
|
-
emits = d.emits
|
283
|
+
d.run(expect_emits: 2, timeout: 3)
|
284
|
+
emits = d.events
|
302
285
|
|
303
286
|
# not acknowledged, but already emitted to engine.
|
304
|
-
|
287
|
+
assert(2 <= emits.length)
|
305
288
|
emits.each do |tag, time, record|
|
306
289
|
assert_equal("test", tag)
|
307
290
|
assert_equal({"foo" => "bar"}, record)
|
@@ -321,10 +304,10 @@ class GcloudPubSubInputTest < Test::Unit::TestCase
|
|
321
304
|
sleep 0.75
|
322
305
|
# d.run sleeps 0.5 sec
|
323
306
|
}
|
324
|
-
emits = d.
|
307
|
+
emits = d.events
|
325
308
|
|
326
309
|
assert_equal(1, emits.length)
|
327
|
-
|
310
|
+
assert_true d.instance.instance_variable_get(:@stop_pull)
|
328
311
|
|
329
312
|
emits.each do |tag, time, record|
|
330
313
|
assert_equal("test", tag)
|
@@ -341,15 +324,15 @@ class GcloudPubSubInputTest < Test::Unit::TestCase
|
|
341
324
|
d.instance.stop_pull
|
342
325
|
assert_equal(true, d.instance.instance_variable_get(:@stop_pull))
|
343
326
|
|
344
|
-
d.run {
|
327
|
+
d.run(expect_emits: 1, timeout: 3) {
|
345
328
|
http_get('/api/in_gcloud_pubsub/pull/start')
|
346
329
|
sleep 0.75
|
347
330
|
# d.run sleeps 0.5 sec
|
348
331
|
}
|
349
|
-
emits = d.
|
332
|
+
emits = d.events
|
350
333
|
|
351
334
|
assert_equal(true, emits.length > 0)
|
352
|
-
|
335
|
+
assert_false d.instance.instance_variable_get(:@stop_pull)
|
353
336
|
|
354
337
|
emits.each do |tag, time, record|
|
355
338
|
assert_equal("test", tag)
|
@@ -359,7 +342,7 @@ class GcloudPubSubInputTest < Test::Unit::TestCase
|
|
359
342
|
|
360
343
|
test 'get status by http rpc when started' do
|
361
344
|
d = create_driver("#{CONFIG}\npull_interval 1.0\nenable_rpc true")
|
362
|
-
|
345
|
+
assert_false d.instance.instance_variable_get(:@stop_pull)
|
363
346
|
|
364
347
|
d.run {
|
365
348
|
res = http_get('/api/in_gcloud_pubsub/pull/status')
|
@@ -370,7 +353,7 @@ class GcloudPubSubInputTest < Test::Unit::TestCase
|
|
370
353
|
test 'get status by http rpc when stopped' do
|
371
354
|
d = create_driver("#{CONFIG}\npull_interval 1.0\nenable_rpc true")
|
372
355
|
d.instance.stop_pull
|
373
|
-
|
356
|
+
assert_true d.instance.instance_variable_get(:@stop_pull)
|
374
357
|
|
375
358
|
d.run {
|
376
359
|
res = http_get('/api/in_gcloud_pubsub/pull/status')
|
@@ -1,6 +1,11 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require_relative "../test_helper"
|
3
|
+
require "fluent/test/driver/output"
|
4
|
+
require "fluent/test/helpers"
|
2
5
|
|
3
6
|
class GcloudPubSubOutputTest < Test::Unit::TestCase
|
7
|
+
include Fluent::Test::Helpers
|
8
|
+
|
4
9
|
CONFIG = %[
|
5
10
|
project project-test
|
6
11
|
topic topic-test
|
@@ -10,7 +15,7 @@ class GcloudPubSubOutputTest < Test::Unit::TestCase
|
|
10
15
|
ReRaisedError = Class.new(RuntimeError)
|
11
16
|
|
12
17
|
def create_driver(conf = CONFIG)
|
13
|
-
Fluent::Test::
|
18
|
+
Fluent::Test::Driver::Output.new(Fluent::Plugin::GcloudPubSubOutput).configure(conf)
|
14
19
|
end
|
15
20
|
|
16
21
|
setup do
|
@@ -117,17 +122,18 @@ class GcloudPubSubOutputTest < Test::Unit::TestCase
|
|
117
122
|
end
|
118
123
|
|
119
124
|
setup do
|
120
|
-
@time =
|
125
|
+
@time = event_time('2016-07-09 11:12:13 UTC')
|
121
126
|
end
|
122
127
|
|
123
128
|
test 'messages are divided into "max_messages"' do
|
124
129
|
d = create_driver
|
125
130
|
@publisher.publish.times(2)
|
126
|
-
|
127
|
-
|
128
|
-
|
131
|
+
d.run(default_tag: "test") do
|
132
|
+
# max_messages is default 1000
|
133
|
+
1001.times do |i|
|
134
|
+
d.feed(@time, {"a" => i})
|
135
|
+
end
|
129
136
|
end
|
130
|
-
d.run
|
131
137
|
end
|
132
138
|
|
133
139
|
test 'messages are divided into "max_total_size"' do
|
@@ -140,11 +146,12 @@ class GcloudPubSubOutputTest < Test::Unit::TestCase
|
|
140
146
|
])
|
141
147
|
|
142
148
|
@publisher.publish.times(2)
|
143
|
-
|
144
|
-
|
145
|
-
|
149
|
+
d.run(default_tag: "test") do
|
150
|
+
# 400 * 4 / max_total_size = twice
|
151
|
+
4.times do
|
152
|
+
d.feed(@time, {"a" => "a" * 400})
|
153
|
+
end
|
146
154
|
end
|
147
|
-
d.run
|
148
155
|
end
|
149
156
|
|
150
157
|
test 'messages exceeding "max_message_size" are not published' do
|
@@ -156,24 +163,27 @@ class GcloudPubSubOutputTest < Test::Unit::TestCase
|
|
156
163
|
])
|
157
164
|
|
158
165
|
@publisher.publish.times(0)
|
159
|
-
d.
|
160
|
-
|
166
|
+
d.run(default_tag: "test") do
|
167
|
+
d.feed(@time, {"a" => "a" * 1000})
|
168
|
+
end
|
161
169
|
end
|
162
170
|
|
163
171
|
test 'accept "ASCII-8BIT" encoded multibyte strings' do
|
164
172
|
# on fluentd v0.14, all strings treated as "ASCII-8BIT" except specified encoding.
|
165
173
|
d = create_driver
|
166
174
|
@publisher.publish.once
|
167
|
-
d.
|
168
|
-
|
175
|
+
d.run(default_tag: "test") do
|
176
|
+
d.feed(@time, {"a" => "あああ".force_encoding("ASCII-8BIT")})
|
177
|
+
end
|
169
178
|
end
|
170
179
|
|
171
180
|
test 'reraise unexpected errors' do
|
172
181
|
d = create_driver
|
173
182
|
@publisher.publish.once { raise ReRaisedError }
|
174
183
|
assert_raises ReRaisedError do
|
175
|
-
d.
|
176
|
-
|
184
|
+
d.run(default_tag: "test") do
|
185
|
+
d.feed([{'a' => 1, 'b' => 2}])
|
186
|
+
end
|
177
187
|
end
|
178
188
|
end
|
179
189
|
|
@@ -181,8 +191,9 @@ class GcloudPubSubOutputTest < Test::Unit::TestCase
|
|
181
191
|
d = create_driver
|
182
192
|
@publisher.publish.once { raise Google::Cloud::UnavailableError.new('TEST') }
|
183
193
|
assert_raises Fluent::GcloudPubSub::RetryableError do
|
184
|
-
d.
|
185
|
-
|
194
|
+
d.run(default_tag: "test") do
|
195
|
+
d.feed([{'a' => 1, 'b' => 2}])
|
196
|
+
end
|
186
197
|
end
|
187
198
|
end
|
188
199
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-gcloud-pubsub-custom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yoshihiro MIYAI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.14.15
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '2'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.14.15
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2'
|
@@ -124,7 +124,6 @@ files:
|
|
124
124
|
- ".travis.yml"
|
125
125
|
- CHANGELOG.md
|
126
126
|
- Gemfile
|
127
|
-
- Gemfile.v0.12
|
128
127
|
- LICENSE
|
129
128
|
- README.md
|
130
129
|
- Rakefile
|