test/test_out_s3.rb in fluent-plugin-s3-0.7.2 vs test/test_out_s3.rb in fluent-plugin-s3-0.8.0.rc1
- old
+ new
@@ -249,11 +249,10 @@
%[2011-01-02T13:14:15Z\ttest\t{"a":2}\n],
data.first
end
CONFIG_TIME_SLICE = %[
- hostname testing.node.local
aws_key_id test_key_id
aws_sec_key test_sec_key
s3_bucket test_bucket
s3_object_key_format %{path}/events/ts=%{time_slice}/events_%{index}-%{hostname}.%{file_extension}
time_slice_format %Y%m%d-%H
@@ -297,15 +296,22 @@
end
FileUtils.rm_f(s3_local_file_path)
end
def test_write_with_custom_s3_object_key_format_containing_uuid_flush_placeholder
+
+ begin
+ require 'uuidtools'
+ rescue LoadError
+ pend("uuidtools not found. skip this test")
+ end
+
# Partial mock the S3Bucket, not to make an actual connection to Amazon S3
setup_mocks(true)
uuid = "5755e23f-9b54-42d8-8818-2ea38c6f279e"
- stub(UUIDTools::UUID).random_create{ uuid }
+ stub(::UUIDTools::UUID).random_create{ uuid }
s3_local_file_path = "/tmp/s3-test.txt"
s3path = "log/events/ts=20110102-13/events_0-#{uuid}.gz"
setup_s3_object_mocks(s3_local_file_path: s3_local_file_path, s3path: s3path)
@@ -378,10 +384,10 @@
@s3_bucket.object(anything).at_least(0) { @s3_object }
@s3_resource.bucket(anything) { @s3_bucket }
end
def setup_s3_object_mocks(params = {})
- s3path = params[:s3path] || "log/events/ts=20110102-13/events_0-testing.node.local.gz"
+ s3path = params[:s3path] || "log/events/ts=20110102-13/events_0-#{Socket.gethostname}.gz"
s3_local_file_path = params[:s3_local_file_path] || "/tmp/s3-test.txt"
# Assert content of event logs which are being sent to S3
s3obj = stub(Aws::S3::Object.new(:bucket_name => "test_bucket",
:key => "test",