test/test_out_s3.rb in fluent-plugin-s3-0.8.0 vs test/test_out_s3.rb in fluent-plugin-s3-0.8.1
- old
+ new
@@ -127,9 +127,22 @@
d = create_driver(conf)
assert_equal false, d.instance.check_bucket
assert_equal false, d.instance.check_object
end
+ def test_config_with_hostname_placeholder
+ d = create_driver(<<EOC)
+ aws_key_id test_key_id
+ aws_sec_key test_sec_key
+ s3_bucket test_bucket
+ path log/%{hostname}/test
+ s3_object_key_format %{path}%{hostname}_%{index}
+ buffer_type memory
+EOC
+ assert_match /#{Socket.gethostname}/, d.instance.s3_object_key_format
+ assert_match /#{Socket.gethostname}/, d.instance.path
+ end
+
def test_path_slicing
config = CONFIG.clone.gsub(/path\slog/, "path log/%Y/%m/%d")
d = create_driver(config)
path_slicer = d.instance.instance_variable_get(:@path_slicer)
path = d.instance.instance_variable_get(:@path)