Skip to content

Commit

Permalink
Added a test for the SINCEDB_DIR functionality
Browse files Browse the repository at this point in the history
Setting SINCEDB_DIR in your environment allows you to override the target directory for sincedb files.  The added test verifies that this functionality works properly
  • Loading branch information
tejaycar committed Jun 21, 2013
1 parent be71326 commit 815f5b2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/logstash/inputs/test_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,18 @@
flunk "An absolute path containing a wildcard should be valid"
end
end

test "file input should use SINCEDB_DIR environment variable as default sincedb location if it is set" do
logfile = Tempfile.new("logstash")
the_destination = "/tmp/sincedb"
ENV['SINCEDB_DIR'] = the_destination
begin
@input = LogStash::Inputs::File.new("type" => ["testing"], "path" => [logfile.path])
@input.register
assert_equal File.dirname(@input.instance_variable_get(:@sincedb_dir)) the_destination
ensure
logfile.close
logfile.unlink
end

end # testing for LogStash::Inputs::File

0 comments on commit 815f5b2

Please sign in to comment.