fluent-plugin-azure-storage-append-blob-lts 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f0868aba2220e9c160b9e8bec8854921864b580c1b7cb1d05845ca9e73c4606
4
- data.tar.gz: 4d73dcf3a57b45018de76a862407062049735da53e96aa664db6304bc65b8718
3
+ metadata.gz: e1dca8c31f6ec0f0383d24637d3c0b6225d92e8505387a5c1a422d85057f0340
4
+ data.tar.gz: 240d435415a53386a245d3449d092eb2d71a85c2e08e989b841ec71b7a20a9f5
5
5
  SHA512:
6
- metadata.gz: d72f2ccdfb8c92f13694c05f4fc9a349144dd4016b0c1eebee613d8ef536a5072a8635028a097cf21a546220cd11f870eddd4675b1e3241194b39d2a0ddf2d46
7
- data.tar.gz: a7dfd1c386ed529d9ead3978fe436c7f69a653bd4ce206b5755c8af78142464c4779ab3d781fc14c035f650e5e8940c97a8a4dca240a933ffb5d733b924d9ae3
6
+ metadata.gz: 7744655dfad7169b43df0db53a20c781276d8dba8a83c2858e1809cb281008e9b401b6755ec6fb0efa4eff0311c2e76fc2d2e60164ffd373ef0087b81fabc9cf
7
+ data.tar.gz: 046e1e69571d6502d6c06d52d49c3e97234f4b2a44e15210122941d6787bac825769b40f2c1e70cff926f8d5a6ca9cf916ee2aac42b06a82367c7b9c0f410279
@@ -11,14 +11,12 @@ jobs:
11
11
  build:
12
12
  name: Build + Publish
13
13
  runs-on: ubuntu-latest
14
-
15
14
  steps:
16
15
  - uses: actions/checkout@v2
17
16
  - name: Set up Ruby 2.6
18
17
  uses: actions/setup-ruby@v1
19
18
  with:
20
19
  ruby-version: 2.6.x
21
-
22
20
  - name: Publish to RubyGems
23
21
  run: |
24
22
  mkdir -p $HOME/.gem
@@ -8,9 +8,7 @@ on:
8
8
 
9
9
  jobs:
10
10
  test:
11
-
12
11
  runs-on: ubuntu-latest
13
-
14
12
  steps:
15
13
  - uses: actions/checkout@v2
16
14
  - name: Set up Ruby
@@ -3,12 +3,12 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'fluent-plugin-azure-storage-append-blob-lts'
6
- spec.version = '0.4.0'
6
+ spec.version = '0.5.0'
7
7
  spec.authors = ['Jonas-Taha El Sesiy']
8
- spec.email = ['']
8
+ spec.email = ['github@elsesiy.com']
9
9
 
10
10
  spec.summary = 'Azure Storage Append Blob output plugin for Fluentd event collector'
11
- spec.description = 'Fluentd plugin to upload logs to Azure Storage append blobs. Fork of https://github.com/elsesiy/fluent-plugin-azure-storage-append-blob'
11
+ spec.description = 'Fluentd plugin to upload logs to Azure Storage append blobs. Fork of https://github.com/microsoft/fluent-plugin-azure-storage-append-blob'
12
12
  spec.homepage = 'https://github.com/elsesiy/fluent-plugin-azure-storage-append-blob-lts'
13
13
  spec.license = 'MIT'
14
14
 
@@ -61,15 +61,14 @@ module Fluent
61
61
  end
62
62
  end
63
63
 
64
- raise ConfigError, 'azure_storage_account needs to be specified' if @azure_storage_account.nil?
65
-
66
- raise ConfigError, 'azure_container needs to be specified' if @azure_container.nil?
67
-
68
64
  if (@azure_storage_access_key.nil? || @azure_storage_access_key.empty?) &&
69
65
  (@azure_storage_sas_token.nil? || @azure_storage_sas_token.empty?) &&
70
66
  (@azure_storage_connection_string.nil? || @azure_storage_connection_string.empty?)
71
- log.info 'Using MSI since neither azure_storage_access_key nor azure_storage_sas_token was provided.'
67
+ log.info 'Using MSI since neither of azure_storage_access_key, azure_storage_sas_token, azure_storage_connection_string was provided.'
72
68
  @use_msi = true
69
+ elsif @azure_storage_connection_string.nil? || @azure_storage_connection_string.empty?
70
+ raise ConfigError, 'azure_storage_account needs to be specified' if @azure_storage_account.nil?
71
+ raise ConfigError, 'azure_container needs to be specified' if @azure_container.nil?
73
72
  end
74
73
  end
75
74
 
@@ -18,6 +18,12 @@ class AzureStorageAppendBlobOutTest < Test::Unit::TestCase
18
18
  path log
19
19
  ).freeze
20
20
 
21
+ CONNSTR_CONFIG = %(
22
+ azure_storage_connection_string https://test
23
+ time_slice_format %Y%m%d-%H
24
+ path log
25
+ ).freeze
26
+
21
27
  MSI_CONFIG = %(
22
28
  azure_storage_account test_storage_account
23
29
  azure_container test_container
@@ -66,6 +72,13 @@ class AzureStorageAppendBlobOutTest < Test::Unit::TestCase
66
72
  assert_equal 120, d.instance.azure_token_refresh_interval
67
73
  assert_equal '1970-01-01', d.instance.azure_imds_api_version
68
74
  end
75
+
76
+ test 'config with connection string should set instance variables' do
77
+ d = create_driver conf: CONNSTR_CONFIG
78
+ assert_equal 'https://test', d.instance.azure_storage_connection_string
79
+ assert_equal false, d.instance.use_msi
80
+ assert_equal true, d.instance.auto_create_container
81
+ end
69
82
  end
70
83
 
71
84
  sub_test_case 'test path slicing' do
@@ -92,15 +105,13 @@ class AzureStorageAppendBlobOutTest < Test::Unit::TestCase
92
105
  # This class is used to create an Azure::Core::Http::HTTPError. HTTPError parses
93
106
  # a response object when it is created.
94
107
  class FakeResponse
95
- def initialize(status=404)
108
+ def initialize(status = 404)
96
109
  @status = status
97
- @body = "body"
110
+ @body = 'body'
98
111
  @headers = {}
99
112
  end
100
113
 
101
- attr_reader :status
102
- attr_reader :body
103
- attr_reader :headers
114
+ attr_reader :status, :body, :headers
104
115
  end
105
116
 
106
117
  # This class is used to test plugin functions which interact with the blob service
@@ -125,18 +136,18 @@ class AzureStorageAppendBlobOutTest < Test::Unit::TestCase
125
136
  sub_test_case 'test container_exists' do
126
137
  test 'container 404 returns false' do
127
138
  d = create_driver service: FakeBlobService.new(404)
128
- assert_false d.instance.container_exists? "anything"
139
+ assert_false d.instance.container_exists? 'anything'
129
140
  end
130
141
 
131
142
  test 'existing container returns true' do
132
143
  d = create_driver service: FakeBlobService.new(200)
133
- assert_true d.instance.container_exists? "anything"
144
+ assert_true d.instance.container_exists? 'anything'
134
145
  end
135
146
 
136
147
  test 'unexpected exception raises' do
137
148
  d = create_driver service: FakeBlobService.new(500)
138
149
  assert_raise_kind_of Azure::Core::Http::HTTPError do
139
- d.instance.container_exists? "anything"
150
+ d.instance.container_exists? 'anything'
140
151
  end
141
152
  end
142
153
  end
@@ -175,10 +186,10 @@ class AzureStorageAppendBlobOutTest < Test::Unit::TestCase
175
186
 
176
187
  test 'long buffer appends multiple times' do
177
188
  limit = Fluent::Plugin::AzureStorageAppendBlobOut::AZURE_BLOCK_SIZE_LIMIT
178
- buf_1 = 'a' * limit
179
- buf_2 = 'a' * 3
180
- blocks = fake_appended_blocks buf_1 + buf_2
181
- assert_equal [buf_1, buf_2], blocks
189
+ buf1 = 'a' * limit
190
+ buf2 = 'a' * 3
191
+ blocks = fake_appended_blocks buf1 + buf2
192
+ assert_equal [buf1, buf2], blocks
182
193
  end
183
194
  end
184
195
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-azure-storage-append-blob-lts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas-Taha El Sesiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2021-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,9 +87,9 @@ dependencies:
87
87
  - !ruby/object:Gem::Version
88
88
  version: '2'
89
89
  description: Fluentd plugin to upload logs to Azure Storage append blobs. Fork of
90
- https://github.com/elsesiy/fluent-plugin-azure-storage-append-blob
90
+ https://github.com/microsoft/fluent-plugin-azure-storage-append-blob
91
91
  email:
92
- - ''
92
+ - github@elsesiy.com
93
93
  executables: []
94
94
  extensions: []
95
95
  extra_rdoc_files: []