Skip to content

Commit

Permalink
test_in_tail: Add test_watch_wildcard_path_without_watch_timer
Browse files Browse the repository at this point in the history
#3541 (comment)

Signed-off-by: Takuro Ashie <[email protected]>
  • Loading branch information
ashie committed Nov 1, 2021
1 parent 1dae546 commit 494055e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,35 @@ def test_emit_without_watch_timer(data)
assert_equal({"message" => "test4"}, events[1][2])
end

# https://github.com/fluent/fluentd/pull/3541#discussion_r740197711
def test_watch_wildcard_path_without_watch_timer
config = config_element("ROOT", "", {
"path" => "#{TMP_DIR}/tail*.txt",
"tag" => "t1",
})
config = config + CONFIG_DISABLE_WATCH_TIMER + SINGLE_LINE_CONFIG
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
f.puts "test1"
f.puts "test2"
}

d = create_driver(config, false)

d.run(expect_emits: 1) do
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
f.puts "test3"
f.puts "test4"
}
end

assert_equal(
[
{"message" => "test3"},
{"message" => "test4"},
],
d.events.collect { |event| event[2] })
end

data(flat: CONFIG_DISABLE_STAT_WATCHER + SINGLE_LINE_CONFIG,
parse: CONFIG_DISABLE_STAT_WATCHER + PARSE_SINGLE_LINE_CONFIG)
def test_emit_with_disable_stat_watcher(data)
Expand Down

0 comments on commit 494055e

Please sign in to comment.