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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d878aabfbf2141b06cc3cb88ed30dc9fd489489
4
- data.tar.gz: 3afc6cd5e1526c59ff1790be228b34b790c82257
3
+ metadata.gz: 1ccd2b32a5f18bcec2bb55a04d4406a07e89f514
4
+ data.tar.gz: bbc2ba5ee9e6c17d4b4d4713fa6cf515acb8dff3
5
5
  SHA512:
6
- metadata.gz: fcf5cf434f2c383105e2c5cbef2d66774c73ccec45458847e16740dce51435e4f7536656b2c588ec83652821a5de7b9bc0d7b4834dba60279f20545e583709fa
7
- data.tar.gz: 1bec29afa87de15cb29ccd1881a11ec82086696f25225a22156ca986955ad21efe78011759d599dc1eaaeb37d796f96e791543fcf2b81979be83f5a817aead2b
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.2"
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')
@@ -8,6 +8,7 @@ rescue Bundler::BundlerError => e
8
8
  exit e.status_code
9
9
  end
10
10
  require 'test/unit'
11
+ require "test/unit/rr"
11
12
 
12
13
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
13
14
  $LOAD_PATH.unshift(File.dirname(__FILE__))
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.2
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: 2015-10-19 00:00:00.000000000 Z
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.4.5.1
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