@@ -582,6 +582,34 @@ def test_pipeline_preprocessing_does_not_add_timestamp_delta_if_configured_but_l
582582 result = connector .get_next (0.01 )
583583 assert result == {"any" : "content" }
584584
585+ @pytest .mark .parametrize (
586+ ["timestamp" , "expected_error_message" , "message" ],
587+ [
588+ ("0000-00-00 00:00:00" , "out of range" , "Timestamp is out of range" ),
589+ ("invalid" , "Invalid isoformat" , "Timestamp is invalid" ),
590+ ],
591+ )
592+ def test_pipeline_preprocessing_raises_criticalinputerror_on_timeparser_error (
593+ self , timestamp , expected_error_message , message
594+ ):
595+ preprocessing_config = {
596+ "preprocessing" : {
597+ "log_arrival_time_target_field" : "arrival_time" ,
598+ "log_arrival_timedelta" : {
599+ "target_field" : "log_arrival_timedelta" ,
600+ "reference_field" : "@timestamp" ,
601+ },
602+ }
603+ }
604+ connector_config = deepcopy (self .CONFIG )
605+ connector_config .update (preprocessing_config )
606+ connector = Factory .create ({"test connector" : connector_config })
607+ test_event = {"any" : "content" , "@timestamp" : timestamp }
608+ connector ._get_event = mock .MagicMock (return_value = (test_event , None ))
609+ with pytest .raises (CriticalInputError , match = expected_error_message ) as error :
610+ _ , _ = connector .get_next (0.01 )
611+ assert error .value .raw_input , message
612+
585613 def test_preprocessing_enriches_by_env_variable (self ):
586614 preprocessing_config = {
587615 "preprocessing" : {
0 commit comments