fluent-plugin-gcloud-pubsub 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/fluent-plugin-gcloud-pubsub.gemspec +2 -1
- data/lib/fluent/plugin/out_gcloud_pubsub.rb +2 -1
- data/test/plugin/test_out_gcloud_pubsub.rb +25 -0
- data/test/test_helper.rb +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ccd2b32a5f18bcec2bb55a04d4406a07e89f514
|
4
|
+
data.tar.gz: bbc2ba5ee9e6c17d4b4d4713fa6cf515acb8dff3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6b5456a06149be4189826ead4c7a95150a24030d6b1a4d7b18389bd663afb1855a1ecaa6a2b55eb6b597c369b7f514b1f7a2035ac88a9338f49d171be250570
|
7
|
+
data.tar.gz: 49fcffbc203e01cc9e88704c3746aa50df6aab71042abf45082dbb0c784531db8c9c60beac0711373d3510b610c0700d85f3cf885c4720a45294e43276782628
|
data/README.md
CHANGED
@@ -35,9 +35,12 @@ publish dummy json data like `{"message": "dummy", "value": 0}\n{"message": "dum
|
|
35
35
|
topic <YOUR TOPIC>
|
36
36
|
key <YOUR KEY>
|
37
37
|
flush_interval 10
|
38
|
+
autocreate_topic false
|
38
39
|
</match>
|
39
40
|
```
|
40
41
|
|
42
|
+
- `autocreate_topic` (optional, default: `false`)
|
43
|
+
- If set to `true`, specified topic will be created when it doesn't exist.
|
41
44
|
|
42
45
|
## Pull messages
|
43
46
|
Use `in_gcloud_pubsub`.
|
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.license = "MIT"
|
8
8
|
gem.homepage = "https://github.com/mdoi/fluent-plugin-gcloud-pubsub"
|
9
9
|
gem.summary = gem.description
|
10
|
-
gem.version = "0.0.
|
10
|
+
gem.version = "0.0.3"
|
11
11
|
gem.authors = ["Masayuki DOI"]
|
12
12
|
gem.email = "dotquasar@gmail.com"
|
13
13
|
gem.has_rdoc = false
|
@@ -23,4 +23,5 @@ Gem::Specification.new do |gem|
|
|
23
23
|
gem.add_development_dependency "bundler"
|
24
24
|
gem.add_development_dependency "rake"
|
25
25
|
gem.add_development_dependency "test-unit"
|
26
|
+
gem.add_development_dependency "test-unit-rr"
|
26
27
|
end
|
@@ -14,6 +14,7 @@ module Fluent
|
|
14
14
|
config_param :project, :string, :default => nil
|
15
15
|
config_param :topic, :string, :default => nil
|
16
16
|
config_param :key, :string, :default => nil
|
17
|
+
config_param :autocreate_topic, :bool, :default => false
|
17
18
|
|
18
19
|
unless method_defined?(:log)
|
19
20
|
define_method("log") { $log }
|
@@ -35,7 +36,7 @@ module Fluent
|
|
35
36
|
super
|
36
37
|
|
37
38
|
pubsub = (Gcloud.new @project, @key).pubsub
|
38
|
-
@client = pubsub.topic @topic
|
39
|
+
@client = pubsub.topic @topic, autocreate: @autocreate_topic
|
39
40
|
end
|
40
41
|
|
41
42
|
def format(tag, time, record)
|
@@ -31,9 +31,34 @@ class GcloudPubSubOutputTest < Test::Unit::TestCase
|
|
31
31
|
assert_equal('project-test', d.instance.project)
|
32
32
|
assert_equal('topic-test', d.instance.topic)
|
33
33
|
assert_equal('key-test', d.instance.key)
|
34
|
+
assert_equal(false, d.instance.autocreate_topic)
|
34
35
|
assert_equal(1, d.instance.flush_interval)
|
35
36
|
end
|
36
37
|
|
38
|
+
def test_autocreate_topic
|
39
|
+
d = create_driver(<<-EOC)
|
40
|
+
type gcloud_pubsub
|
41
|
+
project project-test
|
42
|
+
topic topic-test
|
43
|
+
key key-test
|
44
|
+
flush_interval 1
|
45
|
+
autocreate_topic true
|
46
|
+
EOC
|
47
|
+
|
48
|
+
assert_equal(true, d.instance.autocreate_topic)
|
49
|
+
|
50
|
+
chunk = Fluent::MemoryBufferChunk.new('key', 'data')
|
51
|
+
client = mock!
|
52
|
+
client.topic("topic-test", autocreate: true).once
|
53
|
+
|
54
|
+
gcloud_mock = mock!.pubsub { client }
|
55
|
+
stub(Gcloud).new { gcloud_mock }
|
56
|
+
|
57
|
+
d.instance.instance_variable_set(:@client, client)
|
58
|
+
|
59
|
+
d.instance.start()
|
60
|
+
end
|
61
|
+
|
37
62
|
def test_re_raise_errors
|
38
63
|
d = create_driver(DEFAULT_CONFIG)
|
39
64
|
chunk = Fluent::MemoryBufferChunk.new('key', 'data')
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-gcloud-pubsub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masayuki DOI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: test-unit-rr
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Google Cloud Pub/Sub input/output plugin for Fluentd event collector
|
98
112
|
email: dotquasar@gmail.com
|
99
113
|
executables: []
|
@@ -132,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
146
|
version: '0'
|
133
147
|
requirements: []
|
134
148
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
149
|
+
rubygems_version: 2.5.1
|
136
150
|
signing_key:
|
137
151
|
specification_version: 4
|
138
152
|
summary: Google Cloud Pub/Sub input/output plugin for Fluentd event collector
|