test/test_out_s3.rb in fluent-plugin-s3-0.6.3 vs test/test_out_s3.rb in fluent-plugin-s3-0.6.4

- old
+ new

@@ -465,9 +465,33 @@ client = d.instance.instance_variable_get(:@s3).client credentials = client.config.credentials assert_equal(expected_credentials, credentials) end + def test_assume_role_credentials_with_region + expected_credentials = Aws::Credentials.new("test_key", "test_secret") + sts_client = Aws::STS::Client.new(:region => 'ap-northeast-1') + mock(Aws::STS::Client).new(:region => 'ap-northeast-1'){ sts_client } + mock(Aws::AssumeRoleCredentials).new(:role_arn => "test_arn", + :role_session_name => "test_session", + :client => sts_client){ + expected_credentials + } + config = CONFIG_TIME_SLICE.split("\n").reject{|x| x =~ /.+aws_.+/}.join("\n") + config += %[ + s3_region ap-northeast-1 + <assume_role_credentials> + role_arn test_arn + role_session_name test_session + </assume_role_credentials> + ] + d = create_time_sliced_driver(config) + assert_nothing_raised{ d.run } + client = d.instance.instance_variable_get(:@s3).client + credentials = client.config.credentials + assert_equal(expected_credentials, credentials) + end + def test_instance_profile_credentials expected_credentials = Aws::Credentials.new("test_key", "test_secret") mock(Aws::InstanceProfileCredentials).new({}).returns(expected_credentials) config = CONFIG_TIME_SLICE.split("\n").reject{|x| x =~ /.+aws_.+/}.join("\n") config += %[