@@ -12,6 +12,12 @@ def setup
1212 path test/fixture
1313 )
1414
15+ @badmsg_config = %(
16+ tag test
17+ path test/fixture/corrupt
18+ read_from_head true
19+ )
20+
1521 @strip_config = base_config + %(
1622 strip_underscores true
1723 )
@@ -37,7 +43,8 @@ def setup
3743 )
3844 end
3945
40- attr_reader :journal , :base_config , :pos_path , :pos_config , :head_config , :filter_config , :strip_config , :tail_config
46+ attr_reader :journal , :base_config , :pos_path , :pos_config , :head_config ,
47+ :filter_config , :strip_config , :tail_config , :badmsg_config
4148
4249 def create_driver ( config )
4350 Fluent ::Test ::InputTestDriver . new ( Fluent ::SystemdInput ) . configure ( config )
@@ -112,7 +119,6 @@ def test_reading_from_the_journal_tail_with_strip_underscores
112119 d . run
113120 end
114121
115-
116122 def test_pos_file_is_written
117123 d = create_driver ( pos_config )
118124 d . run
@@ -140,7 +146,7 @@ def test_reading_from_a_pos
140146 assert_equal 143 , d . emits . size
141147 end
142148
143- def test_reading_from_an_invalid_pos # rubocop:disable Metrics/AbcSize
149+ def test_reading_from_an_invalid_pos
144150 file = File . open ( pos_path , "w+" )
145151 file . print "thisisinvalid"
146152 file . close
@@ -180,4 +186,10 @@ def test_reading_from_the_journal_tail_explicit_setting
180186 d . run
181187 end
182188
189+ def test_continue_on_bad_message
190+ d = create_driver ( badmsg_config )
191+ d . run
192+ assert_equal 460 , d . events . size
193+ end
194+
183195end
0 commit comments