|
34 | 34 | event1 = LogStash::Event.new("message" => "hello this is log 1", "host" => "host1")
|
35 | 35 | event2 = LogStash::Event.new("message" => "hello this is log 2", "host" => "host2")
|
36 | 36 | event3 = LogStash::Event.new("message" => "hello this is log 3", "host" => "host3")
|
37 |
| - expect(client).to receive(:post).once.with("https://localhost.logicmonitor.com/rest/log/ingest",:body => LogStash::Json.dump( |
38 |
| - [{"message" => "hello this is log 1", "_lm.resourceId" => {"test.property" => "host1"}, "timestamp" => event1.timestamp.to_s,"@version":"1", "host" => "host1"}, |
39 |
| - {"message" => "hello this is log 2", "_lm.resourceId" => {"test.property" => "host2"}, "timestamp" => event2.timestamp.to_s,"@version":"1", "host" => "host2"}, |
40 |
| - {"message" => "hello this is log 3", "_lm.resourceId" => {"test.property" => "host3"}, "timestamp" => event3.timestamp.to_s} |
| 37 | + expect(client).to receive(:post).once.with("https://localhost.logicmonitor.com/rest/log/ingest",hash_including(:body => LogStash::Json.dump( |
| 38 | + [{ "host" => "host1", "message" => "hello this is log 1","@version":"1", "_lm.resourceId" => {"test.property" => "host1"}, "timestamp" => event1.timestamp.to_s,}, |
| 39 | + {"host" => "host2","message" => "hello this is log 2","@version":"1", "_lm.resourceId" => {"test.property" => "host2"}, "timestamp" => event2.timestamp.to_s}, |
| 40 | + {"host" => "host3","message" => "hello this is log 3","@version":"1", "_lm.resourceId" => {"test.property" => "host3"}, "timestamp" => event3.timestamp.to_s} |
41 | 41 | ]
|
42 |
| - )).and_call_original |
| 42 | + ))).and_call_original |
43 | 43 | @lmlogs.multi_receive([event1, event2, event3])
|
44 | 44 | end
|
45 | 45 |
|
|
0 commit comments