features/error-reporting.feature in httpimagestore-1.6.0 vs features/error-reporting.feature in httpimagestore-1.7.0
- old
+ new
@@ -1,19 +1,20 @@
-Feature: Image list based thumbnailing and S3 storage
- Storage based on URL specified image names to be generated and stored using two different path formats.
- This configuration should be mostly compatible with pre v1.0 release.
+Feature: Error handling
+ API should provide different status codes with text/plain description body for different error modes.
Background:
Given S3 settings in AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_S3_TEST_BUCKET environment variables
Given httpthumbnailer server is running at http://localhost:3100/health_check
Given httpimagestore server is running at http://localhost:3000/health_check with the following configuration
"""
s3 key="@AWS_ACCESS_KEY_ID@" secret="@AWS_SECRET_ACCESS_KEY@" ssl=false
+ path "uri_part" "/thumbnails/#{input_digest}/#{name}.#{image_mime_extension}"
path "structured-name" "#{dirname}/#{input_digest}/#{basename}-#{image_name}.#{image_mime_extension}"
path "missing" "blah"
path "zero" "zero"
+ path "hash" "#{input_digest}"
put "multipart" ":name_list" {
thumbnail "input" {
"small" operation="crop" width=128 height=128 if-image-name-on="#{name_list}"
"bad" operation="crop" width=0 height=0 if-image-name-on="#{name_list}"
@@ -31,10 +32,16 @@
thumbnail "input" "superlarge" operation="crop" width=16000 height=16000 if-image-name-on="#{name_list}"
thumbnail "input" "large_png" operation="crop" width=7000 height=7000 format="png" if-image-name-on="#{name_list}"
thumbnail "input" "bad_opts" operation="crop" width=128 height=128 options="foo=bar" if-image-name-on="#{name_list}"
}
+ post "filename" "/(?<name>.+?)(\\.[^\\.]+)?$/" {
+ identify "input"
+ store_s3 "input" bucket="@AWS_S3_TEST_BUCKET@" path="hash" cache-root="/tmp"
+ output_store_path "input" path="uri_part"
+ }
+
get "s3" {
source_s3 "original" bucket="@AWS_S3_TEST_BUCKET@" path="missing"
}
get "file" {
@@ -195,9 +202,20 @@
Then response status will be 413
And response content type will be text/plain
And response body will be CRLF ended lines like
"""
thumbnailing of 'input' into 'superlarge' failed: image too large: cache resources exhausted
+ """
+
+ @error-reporting
+ Scenario: Bad URI encoding
+ Given test.jpg file content as request body
+ When I do POST request http://localhost:3000/filename/hello%e9world.jpg
+ Then response status will be 400
+ And response content type will be text/plain
+ And response body will be CRLF ended lines like
+ """
+ invalid UTF-8 encoding in URI: "hello\\xE9world"
"""
@error-reporting
Scenario: Zero body length
Given test.empty file content as request body