Added a test for the SINCEDB_DIR functionality

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
This commit is contained in:
tejaycar 2013-06-21 09:33:35 -05:00
parent be7132603d
commit 815f5b294a

View file

@ -125,5 +125,18 @@ describe LogStash::Inputs::File do
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