Skip to content

Commit

Permalink
Add canary for S3 Express (disabled by default until it's been releas…
Browse files Browse the repository at this point in the history
…ed) (#3462)

## Motivation and Context
Adds canary for S3 Express

## Description
This new canary tests the following APIs
- `ListDirectoryBuckets` (a new API for S3 Express)
- `ListObjectsV2` (converted from a connection recording test in
`integration-tests`)
- `Put/Get/DeleteObject` (the same set of APIs tested for regular S3
bucket and for MRAP in s3 canary)
- `CreateMultipartUpload/UploadPart/CompleteMultipartUpload` (operations
whose default checksum is `None` for S3 Express)
- `DeleteObjects` (an operation that requires request checksum and the
default checksum is CRC32)

## Testing
- verified s3 express canary passed in our release pipeline
- verified setting an environment variable `ENABLE_S3_EXPRESS_CANARY`
correctly skipped the s3 express canary in our release pipeline

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
  • Loading branch information
ysaito1001 authored Mar 8, 2024
1 parent db23423 commit 75ed6fd
Show file tree
Hide file tree
Showing 12 changed files with 642 additions and 514 deletions.
4 changes: 4 additions & 0 deletions aws/rust-runtime/aws-inlineable/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ publish = false
repository = "https://github.com/smithy-lang/smithy-rs"

[dependencies]
# Used by lru, and this forces it to be a later version that avoids
# https://github.com/tkaitchuck/aHash/issues/200
# when built with `cargo update -Z minimal-versions`
ahash = "0.8.11"
aws-credential-types = { path = "../aws-credential-types" }
aws-runtime = { path = "../aws-runtime", features = ["http-02x"] }
aws-sigv4 = { path = "../aws-sigv4" }
Expand Down
4 changes: 3 additions & 1 deletion aws/rust-runtime/aws-inlineable/src/s3_express.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,9 @@ pub(crate) mod identity_provider {
runtime_components: &'a RuntimeComponents,
config_bag: &'a ConfigBag,
) -> Result<SessionCredentials, BoxError> {
let mut config_builder = crate::config::Builder::from_config_bag(config_bag);
// TODO(Post S3Express release): Thread through `BehaviorVersion` from the outer S3 client
let mut config_builder = crate::config::Builder::from_config_bag(config_bag)
.behavior_version(crate::config::BehaviorVersion::latest());

// inherits all runtime components from a current S3 operation but clears out
// out interceptors configured for that operation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class S3Decorator : ClientCodegenDecorator {
ShapeId.from("com.amazonaws.s3#CreateSessionOutput"),
// API returns GetObjectAttributes_Response_ instead of Output
ShapeId.from("com.amazonaws.s3#GetObjectAttributesOutput"),
// API returns ListAllMyDirectoryBucketsResult instead of ListDirectoryBucketsOutput
ShapeId.from("com.amazonaws.s3#ListDirectoryBucketsOutput"),
)

override fun protocols(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ private fun s3ExpressModule(runtimeConfig: RuntimeConfig) =

private fun s3ExpressDependencies(runtimeConfig: RuntimeConfig) =
arrayOf(
// Used by lru, and this forces it to be a later version that avoids
// https://github.com/tkaitchuck/aHash/issues/200
// when built with `cargo update -Z minimal-versions`
CargoDependency.AHash,
AwsCargoDependency.awsCredentialTypes(runtimeConfig),
AwsCargoDependency.awsRuntime(runtimeConfig),
AwsCargoDependency.awsSigv4(runtimeConfig),
Expand Down
193 changes: 0 additions & 193 deletions aws/sdk/integration-tests/s3/tests/data/express/list-objects-v2.json

This file was deleted.

22 changes: 0 additions & 22 deletions aws/sdk/integration-tests/s3/tests/express.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,6 @@ where
aws_sdk_s3::Client::from_conf(update_builder(config).build())
}

// TODO(S3Express): Convert this test to the S3 express section in canary
#[tokio::test]
async fn list_objects_v2() {
let _logs = capture_test_logs();

let http_client =
ReplayingClient::from_file("tests/data/express/list-objects-v2.json").unwrap();
let client = test_client(|b| b.http_client(http_client.clone())).await;

let result = client
.list_objects_v2()
.bucket("s3express-test-bucket--usw2-az1--x-s3")
.send()
.await;
dbg!(result).expect("success");

http_client
.validate_body_and_headers(Some(&["x-amz-s3session-token"]), "application/xml")
.await
.unwrap();
}

#[tokio::test]
async fn mixed_auths() {
let _logs = capture_test_logs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ data class CargoDependency(
}

companion object {
// Forces AHash to be a later version that avoids
// https://github.com/tkaitchuck/aHash/issues/200
val AHash: CargoDependency = CargoDependency("ahash", CratesIo("0.8.11"))
val OnceCell: CargoDependency = CargoDependency("once_cell", CratesIo("1.16"))
val Url: CargoDependency = CargoDependency("url", CratesIo("2.3.1"))
val Bytes: CargoDependency = CargoDependency("bytes", CratesIo("1.0.0"))
Expand Down
7 changes: 7 additions & 0 deletions tools/ci-cdk/canary-lambda/src/canary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ pub fn get_canaries_to_run(
.collect()
}

#[derive(Clone)]
pub struct CanaryEnv {
pub(crate) s3_bucket_name: String,
pub(crate) s3_mrap_bucket_arn: String,
pub(crate) s3_express_bucket_name: String,
pub(crate) expected_transcribe_result: String,
#[allow(dead_code)]
pub(crate) page_size: usize,
Expand All @@ -63,6 +65,7 @@ impl fmt::Debug for CanaryEnv {
f.debug_struct("CanaryEnv")
.field("s3_bucket_name", &"*** redacted ***")
.field("s3_mrap_bucket_arn", &"*** redacted ***")
.field("s3_express_bucket_name", &"*** redacted ***")
.field(
"expected_transcribe_result",
&self.expected_transcribe_result,
Expand All @@ -79,6 +82,9 @@ impl CanaryEnv {
// S3 MRAP bucket name to test against
let s3_mrap_bucket_arn =
env::var("CANARY_S3_MRAP_BUCKET_ARN").expect("CANARY_S3_MRAP_BUCKET_ARN must be set");
// S3 Express bucket name to test against
let s3_express_bucket_name = env::var("CANARY_S3_EXPRESS_BUCKET_NAME")
.expect("CANARY_S3_EXPRESS_BUCKET_NAME must be set");

// Expected transcription from Amazon Transcribe from the embedded audio file.
// This is an environment variable so that the code doesn't need to be changed if
Expand All @@ -97,6 +103,7 @@ impl CanaryEnv {
Self {
s3_bucket_name,
s3_mrap_bucket_arn,
s3_express_bucket_name,
expected_transcribe_result,
page_size,
}
Expand Down
Loading

0 comments on commit 75ed6fd

Please sign in to comment.