Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
Signed-off-by: Yuta Iwama <ganmacs@gmail.com>
  • Loading branch information
ganmacs committed Feb 3, 2020
1 parent 0ffdd84 commit 906abe7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Rake::TestTask.new(:base_test) do |t|
t.test_files = if ENV["WIN_RAPID"]
["test/test_event.rb", "test/test_supervisor.rb", "test/plugin_helper/test_event_loop.rb"]
else
tests = Dir["test/**/test_*.rb"].sort
tests = Dir["test/plugin/in_tail/test_position_*.rb"].sort
if Process.uid.zero?
puts "test_file_util.rb for non-root user env. Disable this test on root environment"
tests.delete("test/plugin/test_file_util.rb")
Expand Down
4 changes: 4 additions & 0 deletions lib/fluent/plugin/in_tail/position_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ def try_compact
@file.truncate(0)
@file.write(entries.join)
else
puts nil, '<============================================================ OUTPUT START HERE'
p 'failed'
puts '<============================================================ OUTPUT CLOSE HERE', nil
nil
# skip
end
end
Expand Down
7 changes: 5 additions & 2 deletions test/plugin/in_tail/test_position_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@ def write_data(f, content)
write_data(@file, TEST_CONTENT)
pf = Fluent::Plugin::TailInput::PositionFile.new(@file, logger: $log)

mock.proxy(pf).fetch_compacted_entries do
mock.proxy(pf).fetch_compacted_entries do |r|
FileUtils.touch(@file.path) # change mtime
r
end

pf.try_compact

@file.seek(0)
lines = @file.readlines
p lines = @file.readlines
p @file
p @file.class
assert_equal 4, lines.size
end
end
Expand Down

0 comments on commit 906abe7

Please sign in to comment.