Skip to content

Commit 35db6b0

Browse files
committed
add test for json_merge + timestamp in message
1 parent d2f75dd commit 35db6b0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/plugin/test_out_sumologic.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,27 @@ def test_emit_json_merge
179179
times:1
180180
end
181181

182+
def test_emit_json_merge_timestamp
183+
config = %{
184+
endpoint https://collectors.sumologic.com/v1/receivers/http/1234
185+
log_format json_merge
186+
source_category test
187+
source_host test
188+
source_name test
189+
190+
}
191+
driver = create_driver(config)
192+
time = event_time
193+
stub_request(:post, 'https://collectors.sumologic.com/v1/receivers/http/1234')
194+
driver.run do
195+
driver.feed("output.test", time, {'message' => '{"timestamp":123}'})
196+
end
197+
assert_requested :post, "https://collectors.sumologic.com/v1/receivers/http/1234",
198+
headers: {'X-Sumo-Category'=>'test', 'X-Sumo-Client'=>'fluentd-output', 'X-Sumo-Host'=>'test', 'X-Sumo-Name'=>'test'},
199+
body: /\A{"timestamp":123}\z/,
200+
times:1
201+
end
202+
182203
def test_emit_with_sumo_metadata
183204
config = %{
184205
endpoint https://collectors.sumologic.com/v1/receivers/http/1234

0 commit comments

Comments
 (0)