Skip to content

Commit cf1c1b9

Browse files
committed
add https test
1 parent 0de699d commit cf1c1b9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/fluent/plugin/test_in_otlp.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@ def test_https_receive_json
184184
assert_equal(200, res.status)
185185
assert_equal(expected_events, d.events)
186186
end
187+
188+
def test_https_receive_protocol_buffers
189+
d = create_driver
190+
res = d.run(expect_records: 1) do
191+
post_https_protobuf("/v1/logs", TestData::ProtocolBuffers::LOGS)
192+
end
193+
194+
expected_events = [["otlp.test", @event_time, { type: "otlp_logs", message: TestData::JSON::LOGS }]]
195+
assert_equal(200, res.status)
196+
assert_equal(expected_events, d.events)
197+
end
187198
end
188199

189200
def compress(data)
@@ -202,6 +213,11 @@ def post_json(path, json, headers: {}, options: {})
202213
post(path, json, headers: headers, options: options)
203214
end
204215

216+
def post_https_protobuf(path, binary, headers: {}, options: {})
217+
headers = headers.merge({ "Content-Type" => "application/x-protobuf" })
218+
post(path, binary, endpoint: "https://127.0.0.1:4318", headers: headers, options: options)
219+
end
220+
205221
def post_protobuf(path, binary, headers: {}, options: {})
206222
headers = headers.merge({ "Content-Type" => "application/x-protobuf" })
207223
post(path, binary, headers: headers, options: options)

0 commit comments

Comments
 (0)