FIX: Gap Of Uploading The Same File Key Twice
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m19s
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m19s
This commit is contained in:
+2
-14
@@ -66,20 +66,8 @@ Both steps of the upload flow, end to end:
|
||||
category, and a storage key this API never issued
|
||||
- answering 404 for a category id no category has, kept distinct from the 500
|
||||
the category lookup itself failing produces
|
||||
|
||||
## `@known-gap`
|
||||
|
||||
One scenario is tagged `@known-gap`. It passes — it pins down what the service
|
||||
does **today**, where that differs from what it is documented to do:
|
||||
|
||||
- **registering the same upload twice answers 500.** `videos.storage_key` is
|
||||
`UNIQUE`, so the retry the API's own error message invites ("retry this
|
||||
request with the same 'key'") fails the insert — after a second MediaConvert
|
||||
job has already been queued for the same file.
|
||||
|
||||
Fixing it means changing the scenario alongside the handler. It is tagged so it
|
||||
is easy to find, and so it can be excluded with
|
||||
`gobdd.WithIgnoredTags("@known-gap")` if that is ever wanted.
|
||||
- answering 409 for a key that was already registered, rather than queueing a
|
||||
second transcoding job for the same file
|
||||
|
||||
## Adding a scenario
|
||||
|
||||
|
||||
@@ -97,8 +97,6 @@ Feature: Video upload
|
||||
| ../videos/escape.mp4 |
|
||||
| videos-of-someone-else/clip.mp4 |
|
||||
|
||||
# An id no category has is the client's mistake, and is answered separately
|
||||
# from the category lookup failing, which is the server's and stays a 500.
|
||||
Scenario: Registering a video under a category id that does not exist
|
||||
Given I have requested an upload slot for "mystery.mp4" of type "video/mp4"
|
||||
And I have uploaded the file to the upload URL
|
||||
@@ -106,14 +104,12 @@ Feature: Video upload
|
||||
Then the request is rejected with status 404
|
||||
And the problem title is "Catagory Does Not Exist"
|
||||
|
||||
# Registration is not idempotent: videos.storage_key is UNIQUE, so a retry
|
||||
# with a key that was already registered fails the insert — after a second
|
||||
# MediaConvert job has already been queued for the same file.
|
||||
@known-gap
|
||||
# A key is registered once. The second attempt is turned away before the
|
||||
# transcoding job is queued, so it cannot leave a duplicate job behind.
|
||||
Scenario: Registering the same upload twice
|
||||
Given I have requested an upload slot for "twice.mp4" of type "video/mp4"
|
||||
And I have uploaded the file to the upload URL
|
||||
And I have registered the uploaded video titled "Filed Once" under categories "other"
|
||||
When I register the uploaded video titled "Filed Twice" under categories "other"
|
||||
Then the request is rejected with status 500
|
||||
And the problem title is "Something Went Wrong Saving The Video Record"
|
||||
Then the request is rejected with status 409
|
||||
And the problem title is "Video Already Registered"
|
||||
|
||||
Reference in New Issue
Block a user