Skip to content

Commit 67000f6

Browse files
authored
Fix test for libsystemd v250 (#101)
The latest libsystemd can read some corrupted entries without errors. Since libsystemd v250, it's specification against journal file corruption changed. https://github.com/systemd/systemd/blob/v250/NEWS#L807-L808 In AlmaLinux9 (libsystemd v250): require "systemd" require "systemd/journal" journal = Systemd::Journal.new(path: "test/fixture/corrupt") entries = journal.to_a # Succeeds without errors entries[2] # Before v250, it couldn't read this entry. => #<Systemd::JournalEntry:0x000000000003ba60 priority: '6', _boot_id: '4737ffc504774b3ba67020bc947f1bc0', _machine_id: 'bb9d0a52a41243829ecd729b40ac0bce', _hostname: 'arch', _source_monotonic_timestamp: '0', _transport: 'kernel', syslog_identifier: 'kernel'> Assuming both old and new libsystemd, it would be good to fix the test in this way. Signed-off-by: Daijiro Fukuda <[email protected]>
1 parent 3ec3769 commit 67000f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/plugin/test_in_systemd.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,10 @@ def test_journal_not_present
262262
end
263263

264264
def test_reading_from_a_journal_with_corrupted_entries
265+
# One corrupted entry exists in 461 entries. (The 3rd entry is corrupted.)
265266
d = create_driver(corrupt_entries_config)
266267
d.run(expect_emits: 460)
267-
assert_equal 460, d.events.size
268+
# Since libsystemd v250, it can read this corrupted record.
269+
assert { d.events.size == 460 or d.events.size == 461 }
268270
end
269271
end

0 commit comments

Comments
 (0)