fluent-plugin-azure-storage-append-blob 0.2.0 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a89c4f7d6a51e00949d27e329f80304d3eecb461bea1f4b87f65c799dceeaf4
|
4
|
+
data.tar.gz: dbaa1b0840aa9e99c3bced832851f8c24a65a664260a197e1537baafb341f01f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff251e63e5ccbb5262713ef7a44b59c72b552a534a37eff2ae50d9342e1fcffc328569764c00f61059429441401269c505b221bff681b96737e8aa46a91358c3
|
7
|
+
data.tar.gz: a6ab02e79f9044cec9c08f3799442516c337900e484753d656403fe8c6ce9f62ac58b92056f45aa554d681d4372933e91408f54f99630a83106fefc716e4bade
|
@@ -2,6 +2,10 @@ name: Ruby Gem
|
|
2
2
|
|
3
3
|
on:
|
4
4
|
workflow_dispatch:
|
5
|
+
inputs:
|
6
|
+
otp:
|
7
|
+
description: 'One Time Password'
|
8
|
+
required: true
|
5
9
|
|
6
10
|
jobs:
|
7
11
|
build:
|
@@ -22,6 +26,6 @@ jobs:
|
|
22
26
|
chmod 0600 $HOME/.gem/credentials
|
23
27
|
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_API_KEY}\n" > $HOME/.gem/credentials
|
24
28
|
gem build *.gemspec
|
25
|
-
gem push *.gem
|
29
|
+
gem push *.gem --otp ${{ github.event.inputs.otp }}
|
26
30
|
env:
|
27
31
|
RUBYGEMS_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
@@ -150,10 +150,23 @@ module Fluent
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
+
def container_exists?(container)
|
154
|
+
begin
|
155
|
+
@bs.get_container_properties(container)
|
156
|
+
rescue Azure::Core::Http::HTTPError => ex
|
157
|
+
if ex.status_code == 404 # container does not exist
|
158
|
+
return false
|
159
|
+
else
|
160
|
+
raise
|
161
|
+
end
|
162
|
+
end
|
163
|
+
return true
|
164
|
+
end
|
165
|
+
|
153
166
|
private
|
154
167
|
|
155
168
|
def ensure_container
|
156
|
-
unless
|
169
|
+
unless container_exists? @azure_container
|
157
170
|
if @auto_create_container
|
158
171
|
@bs.create_container(@azure_container)
|
159
172
|
else
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'helper'
|
2
2
|
require 'fluent/plugin/out_azure-storage-append-blob.rb'
|
3
|
+
require 'azure/core/http/http_response'
|
4
|
+
require 'azure/core/http/http_error'
|
3
5
|
|
4
6
|
include Fluent::Test::Helpers
|
5
7
|
|
@@ -83,4 +85,53 @@ class AzureStorageAppendBlobOutTest < Test::Unit::TestCase
|
|
83
85
|
assert_equal slice, Time.now.utc.strftime('log/%Y/%m/%d')
|
84
86
|
end
|
85
87
|
end
|
88
|
+
|
89
|
+
# This class is used to create an Azure::Core::Http::HTTPError. HTTPError parses
|
90
|
+
# a response object when it is created.
|
91
|
+
class FakeResponse
|
92
|
+
def initialize(status=404)
|
93
|
+
@status = status
|
94
|
+
@body = "body"
|
95
|
+
@headers = {}
|
96
|
+
end
|
97
|
+
|
98
|
+
attr_reader :status
|
99
|
+
attr_reader :body
|
100
|
+
attr_reader :headers
|
101
|
+
end
|
102
|
+
|
103
|
+
# This class is used to test plugin functions which interact with the blob service
|
104
|
+
class FakeBlobService
|
105
|
+
def initialize(status)
|
106
|
+
@response = Azure::Core::Http::HttpResponse.new(FakeResponse.new(status))
|
107
|
+
end
|
108
|
+
|
109
|
+
def get_container_properties(container)
|
110
|
+
unless @response.status_code == 200
|
111
|
+
raise Azure::Core::Http::HTTPError.new(@response)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
sub_test_case 'test container_exists' do
|
117
|
+
test 'container 404 returns false' do
|
118
|
+
d = create_driver
|
119
|
+
d.instance.instance_variable_set(:@bs, FakeBlobService.new(404))
|
120
|
+
assert_false d.instance.container_exists? "anything"
|
121
|
+
end
|
122
|
+
|
123
|
+
test 'existing container returns true' do
|
124
|
+
d = create_driver
|
125
|
+
d.instance.instance_variable_set(:@bs, FakeBlobService.new(200))
|
126
|
+
assert_true d.instance.container_exists? "anything"
|
127
|
+
end
|
128
|
+
|
129
|
+
test 'unexpected exception raises' do
|
130
|
+
d = create_driver
|
131
|
+
d.instance.instance_variable_set(:@bs, FakeBlobService.new(500))
|
132
|
+
assert_raise_kind_of Azure::Core::Http::HTTPError do
|
133
|
+
d.instance.container_exists? "anything"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
86
137
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-azure-storage-append-blob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|