Skip to content

Commit

Permalink
Added bucket name to object returned by sqs poller in the unit tests
Browse files Browse the repository at this point in the history
Fixed wrong variable name in the input plugin

Signed-off-by: abdullahzen <abdullah.hzen@gmail.com>
  • Loading branch information
abdullahzen committed Dec 15, 2020
1 parent 54e7b79 commit 544ddfd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/fluent/plugin/in_s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ def start
raise "#{bucket} is not found." unless @buckets[bucket].exists?
end
else
@buckets[bucket] = @s3.bucket(@s3_buckets)
raise "#{bucket} is not found." unless @buckets[bucket].exists?
@buckets[@s3_buckets] = @s3.bucket(@s3_buckets)
raise "#{@s3_buckets} is not found." unless @buckets[@s3_buckets].exists?
end

check_apikeys if @check_apikey_on_start
Expand Down
26 changes: 25 additions & 1 deletion test/test_in_s3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def setup_mocks
mock(Aws::S3::Client).new(anything).at_least(0) { @s3_client }
@s3_resource = mock(Aws::S3::Resource.new(client: @s3_client))
mock(Aws::S3::Resource).new(client: @s3_client) { @s3_resource }
@s3_bucket = mock(Aws::S3::Bucket.new(name: "test",
@s3_bucket = mock(Aws::S3::Bucket.new(name: "test_bucket",
client: @s3_client))
@s3_bucket.exists? { true }
@s3_resource.bucket(anything) { @s3_bucket }
Expand Down Expand Up @@ -278,6 +278,9 @@ def test_one_record
"s3" => {
"object" => {
"key" => "test_key"
},
"bucket" => {
"name"=> "test_bucket"
}
}
}
Expand Down Expand Up @@ -313,6 +316,9 @@ def test_one_record_with_metadata
"s3" => {
"object" => {
"key" => "test_key"
},
"bucket" => {
"name"=> "test_bucket"
}
}
}
Expand Down Expand Up @@ -348,6 +354,9 @@ def test_one_record_url_encoded
"s3" => {
"object" => {
"key" => "test+key"
},
"bucket" => {
"name"=> "test_bucket"
}
}
}
Expand Down Expand Up @@ -383,6 +392,9 @@ def test_one_record_url_encoded_with_metadata
"s3" => {
"object" => {
"key" => "test+key"
},
"bucket" => {
"name"=> "test_bucket"
}
}
}
Expand Down Expand Up @@ -418,6 +430,9 @@ def test_one_record_multi_line
"s3" => {
"object" => {
"key" => "test_key"
},
"bucket" => {
"name"=> "test_bucket"
}
}
}
Expand Down Expand Up @@ -458,6 +473,9 @@ def test_one_record_multi_line_with_metadata
"s3" => {
"object" => {
"key" => "test_key"
},
"bucket" => {
"name"=> "test_bucket"
}
}
}
Expand Down Expand Up @@ -506,6 +524,9 @@ def test_gzip_single_stream
"s3" => {
"object" => {
"key" => "test_key"
},
"bucket" => {
"name"=> "test_bucket"
}
}
}
Expand Down Expand Up @@ -557,6 +578,9 @@ def test_gzip_multiple_steams
"s3" => {
"object" => {
"key" => "test_key"
},
"bucket" => {
"name"=> "test_bucket"
}
}
}
Expand Down

0 comments on commit 544ddfd

Please sign in to comment.