File tree Expand file tree Collapse file tree
logstash-core/spec/logstash Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -477,6 +477,41 @@ def flush(options)
477477 expect ( pipeline . last_error_evaluation_received ) . to match ( /no implicit conversion of nil into Integer/ )
478478 end
479479 end
480+
481+ describe "given a pipeline executing an event with invalid UTF-8 string" do
482+ let ( :pipeline ) do
483+ settings . set_value ( "queue.drain" , true )
484+ LogStash ::JavaPipeline . new (
485+ org . logstash . config . ir . PipelineConfig . new (
486+ LogStash ::Config ::Source ::Local , :main ,
487+ SourceWithMetadata . new (
488+ "config_string" , "config_string" ,
489+ "input { spec_sampler_input {} }\n output { if [message] =~ /^(NOSQL|SQL):/ { spec_sampler_output {} } }"
490+ ) , settings
491+ )
492+ )
493+ end
494+ let ( :event ) do
495+ [ LogStash ::Event . new ( { "message" => "abrac\xC5 adabra" } ) ]
496+ end
497+
498+ let ( :results ) do
499+ PipelineHelpers ::SpecSamplerInput . set_event event
500+ pipeline . run
501+ PipelineHelpers ::SpecSamplerOutput . seen
502+ end
503+
504+ after do
505+ pipeline . close
506+ end
507+
508+ subject { results . length > 1 ? results : results . first }
509+
510+ it "should raise an error without killing the pipeline" do
511+ expect ( subject ) . to be nil
512+ expect ( pipeline . last_error_evaluation_received ) . to match ( /invalid byte sequence in UTF-8/ )
513+ end
514+ end
480515 end
481516 end
482517 end
You can’t perform that action at this time.
0 commit comments