test: add test for PresignedPostPolicy with empty fileName - #2119
Conversation
test: add test for PresignedPostPolicy with empty fileName
There was a problem hiding this comment.
Pull Request Overview
Adds a new functional test to verify behavior when the form file name is empty in a presigned POST policy, and wires it into the test suite.
- Introduce
testPresignedPostPolicyEmptyFileName()covering empty filename error case - Invoke the new test in
main() - No other functional changes
| logError(testName, function, args, startTime, "", "File open failed", err) | ||
| return | ||
| } | ||
| w, err := writer.CreateFormFile("", filePath) |
There was a problem hiding this comment.
The arguments to CreateFormFile are swapped: the first parameter is the form field name and the second is the filename. To test an empty filename, use writer.CreateFormFile("file", "") (or swap the args) instead of an empty field name.
| } | ||
|
|
||
| // testPresignedPostPolicyEmptyFileName tests that an empty file name in the presigned post policy | ||
| func testPresignedPostPolicyEmptyFileName() { |
There was a problem hiding this comment.
[nitpick] This new test duplicates a large portion of testPresignedPostPolicy and testPresignedPostPolicyWrongFile. Consider extracting common setup (client initialization, bucket creation, data reader, policy builder) into a helper to reduce duplication and improve readability.
…y-with-empty-fileName
fix log format
|
@harshavardhana Looks like need the latest minio which have the fix to test https://github.com/minio/minio-go/actions/runs/15437786953/job/43448139531?pr=2119 |
|
@jiuker What you posted looks more like a bug than a test failure to me. Consider failing rather than crashing. |
A bug fixed at minio main branch. |
|
@jiuker Which one? |
minio/minio#21323 this one |
|
@jiuker How can a remote package cause a |
Should be remote minio have the bug code. |
|
@jiuker The test in this package should not panic, just because it doesn't get the response it expects. It should log the error and move on. |
Panic happend at minio code, not this package. |
are you sending a fix? |
Already merged minio/minio#21323 @harshavardhana minio-go/.github/workflows/go.yml Lines 43 to 51 in 1744ff2 This release don't have that fix |
…y-with-empty-fileName
test: add test for PresignedPostPolicy with empty fileName
fix minio/minio#21323 (review)