Skip to content

Commit

Permalink
out_http: add test patterns for gzip feature
Browse files Browse the repository at this point in the history
Signed-off-by: Daijiro Fukuda <[email protected]>
  • Loading branch information
daipom committed Jun 14, 2024
1 parent 5772d4d commit c684509
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions test/plugin/test_out_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,17 @@ def server_port
19882
end

def test_write_with_gzip
data(:json_array, [false, true])
data(:buffer_compress, ["text", "gzip"])
def test_write_with_gzip(data)
d = create_driver(%[
endpoint http://127.0.0.1:#{server_port}/test
compress gzip
json_array #{data[:json_array]}
<buffer>
@type memory
compress #{data[:buffer_compress]}
</buffer>
])
d.run(default_tag: 'test.http') do
test_events.each { |event|
Expand All @@ -546,7 +553,10 @@ def test_write_with_gzip

result = @@result
assert_equal 'POST', result.method
assert_equal 'application/x-ndjson', result.content_type
assert_equal(
data[:json_array] ? 'application/json' : 'application/x-ndjson',
result.content_type
)
assert_equal 'gzip', result.headers['content-encoding']
assert_equal test_events, result.data
assert_not_empty result.headers
Expand Down

0 comments on commit c684509

Please sign in to comment.