Skip to content

Commit

Permalink
Add tooling & fix some missed crates
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoh committed Nov 16, 2023
1 parent 62d5b9f commit d71f5bf
Show file tree
Hide file tree
Showing 13 changed files with 256 additions and 46 deletions.
3 changes: 3 additions & 0 deletions aws/rust-runtime/aws-credential-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ all-features = true
targets = ["x86_64-unknown-linux-gnu"]
rustdoc-args = ["--cfg", "docsrs"]
# End of docs.rs metadata

[package.metadata.smithy-rs-release-tooling]
stable = true
3 changes: 3 additions & 0 deletions aws/rust-runtime/aws-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ all-features = true
targets = ["x86_64-unknown-linux-gnu"]
rustdoc-args = ["--cfg", "docsrs"]
# End of docs.rs metadata

[package.metadata.smithy-rs-release-tooling]
stable = true
3 changes: 3 additions & 0 deletions aws/rust-runtime/aws-sigv4/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ all-features = true
targets = ["x86_64-unknown-linux-gnu"]
rustdoc-args = ["--cfg", "docsrs"]
# End of docs.rs metadata

[package.metadata.smithy-rs-release-tooling]
stable = true
8 changes: 4 additions & 4 deletions aws/sdk/integration-tests/s3/tests/no_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async fn list_objects() {
dbg!(result).expect("success");

http_client
.validate_body_and_headers(None, MediaType::Xml)
.validate_body_and_headers(None, "application/xml")
.await
.unwrap();
}
Expand Down Expand Up @@ -66,7 +66,7 @@ async fn list_objects_v2() {
dbg!(result).expect("success");

http_client
.validate_body_and_headers(None, MediaType::Xml)
.validate_body_and_headers(None, "application/xml")
.await
.unwrap();
}
Expand Down Expand Up @@ -97,7 +97,7 @@ async fn head_object() {
dbg!(result).expect("success");

http_client
.validate_body_and_headers(None, MediaType::Xml)
.validate_body_and_headers(None, "application/xml")
.await
.unwrap();
}
Expand Down Expand Up @@ -128,7 +128,7 @@ async fn get_object() {
dbg!(result).expect("success");

http_client
.validate_body_and_headers(None, MediaType::Xml)
.validate_body_and_headers(None, "application/xml")
.await
.unwrap();
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async fn three_retries_and_then_success() {
let resp = resp.expect("valid e2e test");
assert_eq!(resp.name(), Some("test-bucket"));
http_client
.full_validate(MediaType::Xml)
.full_validate("application/xml")
.await
.expect("failed")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async fn do_endpoint_discovery() {
"content-type",
"x-amz-target",
]),
MediaType::Json,
"application/json",
)
.await
.unwrap();
Expand Down
78 changes: 51 additions & 27 deletions buildSrc/src/main/kotlin/CrateSet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,60 @@ object CrateSet {
* stable = true
*/

val AWS_SDK_RUNTIME = listOf(
Crate("aws-config", STABLE_VERSION_PROP_NAME),
Crate("aws-credential-types", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-endpoint", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-http", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-hyper", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-runtime", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-runtime-api", STABLE_VERSION_PROP_NAME),
Crate("aws-sig-auth", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-sigv4", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-types", STABLE_VERSION_PROP_NAME),
val StableCrates = setOf(
// AWS crates
"aws-config",
"aws-credential-types",
"aws-runtime",
"aws-runtime-api",
"aws-sigv4",
"aws-types",

// smithy crates
"aws-smithy-async",
"aws-smithy-runtime-api",
"aws-smithy-types",
"aws-smithy-types-convert",
"aws-smithy-xml",
)

val version = { name: String ->
when {
StableCrates.contains(name) -> STABLE_VERSION_PROP_NAME
else -> UNSTABLE_VERSION_PROP_NAME
}
}

val AWS_SDK_RUNTIME = listOf(
"aws-config",
"aws-credential-types",
"aws-endpoint",
"aws-http",
"aws-hyper",
"aws-runtime",
"aws-runtime-api",
"aws-sig-auth",
"aws-sigv4",
"aws-types",
).map { Crate(it, version(it)) }

val SMITHY_RUNTIME_COMMON = listOf(
Crate("aws-smithy-async", STABLE_VERSION_PROP_NAME),
Crate("aws-smithy-checksums", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-client", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-eventstream", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-http", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-http-auth", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-http-tower", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-json", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-protocol-test", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-query", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-runtime", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-runtime-api", STABLE_VERSION_PROP_NAME),
Crate("aws-smithy-types", STABLE_VERSION_PROP_NAME),
Crate("aws-smithy-types-convert", UNSTABLE_VERSION_PROP_NAME),
Crate("aws-smithy-xml", UNSTABLE_VERSION_PROP_NAME),
)
"aws-smithy-async",
"aws-smithy-checksums",
"aws-smithy-client",
"aws-smithy-eventstream",
"aws-smithy-http",
"aws-smithy-http-auth",
"aws-smithy-http-tower",
"aws-smithy-json",
"aws-smithy-protocol-test",
"aws-smithy-query",
"aws-smithy-runtime",
"aws-smithy-runtime-api",
"aws-smithy-types",
"aws-smithy-types-convert",
"aws-smithy-xml",
).map { Crate(it, version(it)) }

val AWS_SDK_SMITHY_RUNTIME = SMITHY_RUNTIME_COMMON

Expand Down
3 changes: 3 additions & 0 deletions rust-runtime/aws-smithy-runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ all-features = true
targets = ["x86_64-unknown-linux-gnu"]
rustdoc-args = ["--cfg", "docsrs"]
# End of docs.rs metadata

[package.metadata.smithy-rs-release-tooling]
stable = true
1 change: 0 additions & 1 deletion rust-runtime/aws-smithy-runtime/external-types.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ allowed_external_types = [
"tower_service::Service",

# TODO(https://github.com/smithy-lang/smithy-rs/issues/1193): Once tooling permits it, only allow the following types in the `test-util` feature
"aws_smithy_protocol_test::MediaType",
"bytes::bytes::Bytes",
"serde::ser::Serialize",
"serde::de::Deserialize",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use std::collections::HashMap;
mod record;
mod replay;

pub use aws_smithy_protocol_test::MediaType;
pub use record::RecordingClient;
pub use replay::ReplayingClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ impl ReplayingClient {
}

/// Validate all headers and bodies
pub async fn full_validate(self, media_type: MediaType) -> Result<(), Box<dyn Error>> {
self.validate_body_and_headers(None, media_type).await
pub async fn full_validate(self, media_type: &str) -> Result<(), Box<dyn Error>> {
self.validate_body_and_headers(None, MediaType::from(media_type))
.await
}

/// Validate actual requests against expected requests
Expand All @@ -95,13 +96,13 @@ impl ReplayingClient {
pub async fn validate_body_and_headers(
self,
checked_headers: Option<&[&str]>,
media_type: MediaType,
media_type: &str,
) -> Result<(), Box<dyn Error>> {
self.validate_base(checked_headers, |b1, b2| {
aws_smithy_protocol_test::validate_body(
b1,
std::str::from_utf8(b2).unwrap(),
media_type.clone(),
MediaType::from(media_type),
)
.map_err(|e| Box::new(e) as _)
})
Expand Down
Loading

0 comments on commit d71f5bf

Please sign in to comment.