-
Notifications
You must be signed in to change notification settings - Fork 164
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
Allow enforcing SSE settings for the cache bucket #1131
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e802320
Get SSE from GetObject, add tests for SSE in Express
f6ed6bd
Allow enforcing SSE settings for the cache bucket
16d4504
Crash on error after put, Refactor the test
22d1130
Remove redundant error variant
10777a8
Improve CacheTestWrapper
0f3e5b0
Remove wrong comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -551,3 +551,59 @@ async fn test_get_object_checksum_checksums_disabled() { | |
.await | ||
.expect_err("should not return a checksum object as not requested"); | ||
} | ||
|
||
#[test_case("aws:kms", Some(get_test_kms_key_id()))] | ||
#[test_case("aws:kms:dsse", Some(get_test_kms_key_id()))] | ||
#[test_case("AES256", None)] | ||
#[tokio::test] | ||
#[cfg(not(feature = "s3express_tests"))] | ||
async fn test_get_object_sse(sse_type: &str, kms_key_id: Option<String>) { | ||
test_get_object_sse_base(sse_type, kms_key_id, get_test_bucket()).await; | ||
} | ||
|
||
// We have a separate set of tests for express because: | ||
// 1. via SDK / CRT we can only put an object with the settings that match bucket's defaults: | ||
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-express-specifying-kms-encryption.html | ||
// 2. Express doesn't currently support `aws:kms:dsse`. | ||
#[test_case("AES256", None, get_express_bucket())] | ||
#[test_case("aws:kms", Some(get_test_kms_key_id()), get_express_sse_kms_bucket())] | ||
#[tokio::test] | ||
#[cfg(feature = "s3express_tests")] | ||
async fn test_get_object_sse(sse_type: &str, kms_key_id: Option<String>, bucket: String) { | ||
test_get_object_sse_base(sse_type, kms_key_id, bucket).await; | ||
} | ||
|
||
async fn test_get_object_sse_base(sse_type: &str, kms_key_id: Option<String>, bucket: String) { | ||
let sdk_client = get_test_sdk_client().await; | ||
let prefix = get_unique_test_prefix("test_get_object_sse"); | ||
|
||
let key = format!("{prefix}/test"); | ||
let body = vec![0x42; 42]; | ||
let mut request = sdk_client | ||
.put_object() | ||
.bucket(&bucket) | ||
.key(&key) | ||
.body(ByteStream::from(body.clone())) | ||
.server_side_encryption(sse_type.into()); | ||
if let Some(kms_key_id) = kms_key_id.as_ref() { | ||
request = request.ssekms_key_id(kms_key_id) | ||
} | ||
request.send().await.unwrap(); | ||
|
||
let client: S3CrtClient = get_test_client(); | ||
|
||
let result = client | ||
.get_object( | ||
&bucket, | ||
&key, | ||
&GetObjectParams::new().checksum_mode(Some(ChecksumMode::Enabled)), | ||
) | ||
.await | ||
.expect("get_object should succeed"); | ||
|
||
let (received_sse, received_key_id) = result.get_object_sse().await.expect("should return sse settings"); | ||
assert_eq!(received_sse.expect("sse type must be some"), sse_type); | ||
if let Some(kms_key_id) = kms_key_id { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's |
||
assert_eq!(received_key_id.expect("sse key must be some"), kms_key_id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We don't need checksums enabled here right?