-
Notifications
You must be signed in to change notification settings - Fork 693
test: add test for PresignedPostPolicy with empty fileName #2119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Copilot uses AI. Check for mistakes.
@@ -5586,6 +5586,161 @@ func testPresignedPostPolicyWrongFile() { | |||
logSuccess(testName, function, args, startTime) | |||
} | |||
|
|||
// testPresignedPostPolicyEmptyFileName tests that an empty file name in the presigned post policy | |||
func testPresignedPostPolicyEmptyFileName() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[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.
Copilot uses AI. Check for mistakes.
…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)