From c68450926bd51b2d6b2daa545e0b3ba4280835e7 Mon Sep 17 00:00:00 2001 From: Daijiro Fukuda Date: Fri, 14 Jun 2024 13:26:54 +0900 Subject: [PATCH] out_http: add test patterns for gzip feature Signed-off-by: Daijiro Fukuda --- test/plugin/test_out_http.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/plugin/test_out_http.rb b/test/plugin/test_out_http.rb index a8c39fdbee..404f59739f 100644 --- a/test/plugin/test_out_http.rb +++ b/test/plugin/test_out_http.rb @@ -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]} + + @type memory + compress #{data[:buffer_compress]} + ]) d.run(default_tag: 'test.http') do test_events.each { |event| @@ -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