test/command/test_binlog_reader.rb in fluentd-0.14.8 vs test/command/test_binlog_reader.rb in fluentd-0.14.9
- old
+ new
@@ -56,11 +56,15 @@
TMP_DIR = File.expand_path(File.dirname(__FILE__) + "/../tmp/command/binlog_reader#{ENV['TEST_ENV_NUMBER']}")
def create_message_packed_file(path, times = [event_time], records = [{ 'message' => 'dummy' }])
es = Fluent::MultiEventStream.new(times, records)
v = es.to_msgpack_stream
- File.open("#{TMP_DIR}/#{path}", 'w') do |f|
+ out_path = "#{TMP_DIR}/#{path}"
+ File.open(out_path, 'wb') do |f|
f.print(v)
+ end
+ waiting(5) do
+ sleep 0.5 until File.size(out_path) == v.bytesize
end
end
def setup
FileUtils.rm_rf(TMP_DIR)