update aws-sdk-s3 in tests and fix wrong checksumming behavior in GetObject

This commit is contained in:
Alex Auvolat
2025-02-18 12:56:09 +01:00
parent 730bfee753
commit 45e10e55f9
6 changed files with 98 additions and 43 deletions
+12 -2
View File
@@ -340,7 +340,12 @@ pub async fn handle_get_without_ctx(
enc,
&headers,
pn,
checksum_mode,
ChecksumMode {
// TODO: for multipart uploads, checksums of each part should be stored
// so that we can return the corresponding checksum here
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
enabled: false,
},
)
.await
}
@@ -354,7 +359,12 @@ pub async fn handle_get_without_ctx(
&headers,
range.start,
range.start + range.length,
checksum_mode,
ChecksumMode {
// TODO: for range queries that align with part boundaries,
// we should return the saved checksum of the part
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
enabled: false,
},
)
.await
}
+1
View File
@@ -71,6 +71,7 @@ hyper-util.workspace = true
mktemp.workspace = true
sha2.workspace = true
static_init.workspace = true
assert-json-diff.workspace = true
serde_json.workspace = true
+1 -1
View File
@@ -12,7 +12,7 @@ pub fn build_client(key: &Key) -> Client {
.endpoint_url(format!("http://127.0.0.1:{}", DEFAULT_PORT))
.region(super::REGION)
.credentials_provider(credentials)
.behavior_version(BehaviorVersion::v2023_11_09())
.behavior_version(BehaviorVersion::v2024_03_28())
.build();
Client::from_conf(config)
+17 -6
View File
@@ -189,12 +189,14 @@ async fn test_getobject() {
#[tokio::test]
async fn test_metadata() {
use aws_sdk_s3::primitives::{DateTime, DateTimeFormat};
let ctx = common::context();
let bucket = ctx.create_bucket("testmetadata");
let etag = "\"46cf18a9b447991b450cad3facf5937e\"";
let exp = aws_sdk_s3::primitives::DateTime::from_secs(10000000000);
let exp2 = aws_sdk_s3::primitives::DateTime::from_secs(10000500000);
let exp = DateTime::from_secs(10000000000);
let exp2 = DateTime::from_secs(10000500000);
{
// Note. The AWS client SDK adds a Content-Type header
@@ -227,7 +229,7 @@ async fn test_metadata() {
assert_eq!(o.content_disposition, None);
assert_eq!(o.content_encoding, None);
assert_eq!(o.content_language, None);
assert_eq!(o.expires, None);
assert_eq!(o.expires_string, None);
assert_eq!(o.metadata.unwrap_or_default().len(), 0);
let o = ctx
@@ -250,7 +252,10 @@ async fn test_metadata() {
assert_eq!(o.content_disposition.unwrap().as_str(), "cddummy");
assert_eq!(o.content_encoding.unwrap().as_str(), "cedummy");
assert_eq!(o.content_language.unwrap().as_str(), "cldummy");
assert_eq!(o.expires.unwrap(), exp);
assert_eq!(
o.expires_string.unwrap(),
exp.fmt(DateTimeFormat::HttpDate).unwrap()
);
}
{
@@ -288,7 +293,10 @@ async fn test_metadata() {
assert_eq!(o.content_disposition.unwrap().as_str(), "cdtest");
assert_eq!(o.content_encoding.unwrap().as_str(), "cetest");
assert_eq!(o.content_language.unwrap().as_str(), "cltest");
assert_eq!(o.expires.unwrap(), exp2);
assert_eq!(
o.expires_string.unwrap(),
exp2.fmt(DateTimeFormat::HttpDate).unwrap()
);
let mut meta = o.metadata.unwrap();
assert_eq!(meta.remove("testmeta").unwrap(), "hello people");
assert_eq!(meta.remove("nice-unicode-meta").unwrap(), "宅配便");
@@ -314,7 +322,10 @@ async fn test_metadata() {
assert_eq!(o.content_disposition.unwrap().as_str(), "cddummy");
assert_eq!(o.content_encoding.unwrap().as_str(), "cedummy");
assert_eq!(o.content_language.unwrap().as_str(), "cldummy");
assert_eq!(o.expires.unwrap(), exp);
assert_eq!(
o.expires_string.unwrap(),
exp.fmt(DateTimeFormat::HttpDate).unwrap()
);
}
}