Skip to content
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

Adjust testPresignedPostPolicy to ensure that GetObject... #1996

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

marktheunissen
Copy link
Contributor

@marktheunissen marktheunissen commented Sep 2, 2024

...returns the correct checksum.

  • Add checksum policy conditions to SetChecksum() function of Policy
  • Add Content-Encoding to test
  • Add a new test testPresignedPostPolicyWrongFile to validate Checksums check negative case
  • Linting fixes and general cruft cleanup

For the following issue: minio/minio#20343

Related PR: minio/minio#20674

@marktheunissen marktheunissen changed the title Adjust testPresignedPostPolicy to ensure that GetObject returns the correct checksum. Add checksum headers to policy Adjust testPresignedPostPolicy to ensure that GetObject... Sep 2, 2024
logError(testName, function, args, startTime, "", "PutObject failed", err)
return
}

Copy link
Contributor Author

@marktheunissen marktheunissen Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was just a copy paste mistake, not sure why we were doing a PutObject here, as we are running the PostPolicy presigned request via the http client further down.

post-policy.go Outdated Show resolved Hide resolved
post-policy.go Outdated Show resolved Hide resolved
@marktheunissen
Copy link
Contributor Author

FYI to myself: minio/minio#18074 (comment)

@marktheunissen marktheunissen marked this pull request as draft November 20, 2024 06:24
@marktheunissen
Copy link
Contributor Author

Converted to draft temporarily while I complete the MinIO side.

@marktheunissen marktheunissen force-pushed the checksumpostpolicy branch 3 times, most recently from fee2c7b to efc148e Compare November 21, 2024 02:19
retry.go Outdated Show resolved Hide resolved
post-policy.go Outdated Show resolved Hide resolved
policy := minio.NewPostPolicy()

if err := policy.SetBucket(""); err == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved these negative tests into post-policy_test.go, and then added some more test cases in that file.

return
}

// Ensure that when we subsequently GetObject, the checksum is returned
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the original user request - to have the checksum value returned when doing a GetObject, after doing a Post Policy. That functionality was already merged in MinIO weeks ago so this just adds the test for it.

@@ -5641,9 +5643,6 @@ func testPresignedPostPolicy() {
"policy": "",
}

// Seed random based on current time.
rand.Seed(time.Now().Unix())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated, we can remove this call from every test, I might make a follow up PR to do the rest.

@marktheunissen
Copy link
Contributor Author

@klauspost ready for a re-review when you get a moment :)

@marktheunissen marktheunissen force-pushed the checksumpostpolicy branch 2 times, most recently from 6ce6043 to 913700e Compare November 21, 2024 23:01
…orrect checksum. Add checksum headers to policy
@marktheunissen marktheunissen force-pushed the checksumpostpolicy branch 2 times, most recently from f770da7 to 54e0d3f Compare November 25, 2024 02:14
@harshavardhana harshavardhana merged commit 7fad06c into minio:master Nov 25, 2024
5 checks passed
@marktheunissen marktheunissen deleted the checksumpostpolicy branch November 25, 2024 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants