|
299 | 299 | context "when the event contains an integration metadata index" do
|
300 | 300 | let(:event_fields) { super().merge({"@metadata" => {"_ingest_document" => {"index" => "meta-document-index"}}}) }
|
301 | 301 |
|
302 |
| - it "plugin's configuration metadata index is used" do |
| 302 | + it "event's metadata index is used" do |
303 | 303 | expect(subject.send(:event_action_tuple, event)[1]).to include(:_index => "meta-document-index")
|
304 | 304 | end
|
305 | 305 |
|
306 | 306 | context "when datastream settings are NOT configured" do
|
307 |
| - it "plugin's configuration metadata index is used" do |
| 307 | + it "event's metadata index is used" do |
308 | 308 | expect(subject.send(:event_action_tuple, event)[1]).to include(:_index => "meta-document-index")
|
309 | 309 | end
|
310 | 310 | end
|
311 | 311 |
|
312 | 312 | context "when datastream settings are configured" do
|
313 | 313 | let(:event_fields) { super().merge({"data_stream" => {"type" => "logs", "dataset" => "generic", "namespace" => "default"}}) }
|
314 | 314 |
|
315 |
| - it "plugin's configuration metadata index is used" do |
| 315 | + it "event's metadata index is used" do |
316 | 316 | expect(subject.send(:event_action_tuple, event)[1]).to include(:_index => "meta-document-index")
|
317 | 317 | end
|
318 | 318 | end
|
|
365 | 365 | context "when the event contains an integration metadata document_id" do
|
366 | 366 | let(:event) { LogStash::Event.new({"@metadata" => {"_ingest_document" => {"id" => "meta-document-id"}}}) }
|
367 | 367 |
|
368 |
| - it "plugin's configuration metadata document_id is used" do |
| 368 | + it "event's metadata document_id is used" do |
369 | 369 | expect(subject.send(:event_action_tuple, event)[1]).to include(:_id => "meta-document-id")
|
370 | 370 | end
|
371 | 371 | end
|
|
399 | 399 | let(:options) { super().merge("pipeline" => nil)}
|
400 | 400 |
|
401 | 401 | context "when the event contains an integration metadata pipeline" do
|
402 |
| - let(:event) { LogStash::Event.new({"@metadata" => {"_ingest_document" => {"pipeline" => "integration-pipeline"}}}) } |
| 402 | + let(:metadata) { {"_ingest_document" => {"pipeline" => "integration-pipeline"}} } |
| 403 | + let(:event) { LogStash::Event.new({"@metadata" => metadata}) } |
403 | 404 |
|
404 | 405 | it "event's metadata pipeline is used" do
|
405 | 406 | expect(subject.send(:event_action_tuple, event)[1]).to include(:pipeline => "integration-pipeline")
|
406 | 407 | end
|
| 408 | + |
| 409 | + context "when also target_ingest_pipeline id defined" do |
| 410 | + let(:metadata) { super().merge({"target_ingest_pipeline" => "meta-ingest-pipeline"}) } |
| 411 | + |
| 412 | + it "then event's pipeline from _ingest_document is used" do |
| 413 | + expect(subject.send(:event_action_tuple, event)[1]).to include(:pipeline => "integration-pipeline") |
| 414 | + end |
| 415 | + end |
407 | 416 | end
|
408 | 417 |
|
409 | 418 | context "when the event DOESN'T contains an integration metadata pipeline" do
|
|
894 | 903 | expect(subject.send(:event_action_tuple, event)[1]).to include(:pipeline => "my-ingest-pipeline")
|
895 | 904 | end
|
896 | 905 |
|
897 |
| - context "when event contains also _ingest_document pipeline name" do |
898 |
| - let(:event) { LogStash::Event.new({"pipeline" => "my-ingest-pipeline", |
899 |
| - "@metadata" => {"target_ingest_pipeline" => "meta-ingest-pipeline", |
900 |
| - "_ingest_document" => {"pipeline" => "integration-pipeline"}}}) } |
901 |
| - |
902 |
| - it "precedence is given to the integration" do |
903 |
| - expect(subject.send(:event_action_tuple, event)[1]).to include(:pipeline => "my-ingest-pipeline") |
904 |
| - end |
905 |
| - |
906 |
| - context "when settings doesn't configure a pipeline and integration provides one in the event" do |
907 |
| - let(:options) { { } } |
908 |
| - |
909 |
| - it "the one provided by user takes precedence on all the others" do |
910 |
| - expect(subject.send(:event_action_tuple, event)[1]).to include(:pipeline => "integration-pipeline") |
911 |
| - end |
912 |
| - end |
913 |
| - end |
914 |
| - |
915 | 906 | context "when the plugin's `pipeline` is constant" do
|
916 | 907 | let(:options) { super().merge("pipeline" => "my-constant-pipeline") }
|
917 | 908 | it "uses plugin's pipeline value" do
|
|
0 commit comments