From d0505ea61f3f8b69c4e7996cca37fecb8b83d178 Mon Sep 17 00:00:00 2001 From: ysaito1001 Date: Tue, 19 Sep 2023 21:32:05 +0000 Subject: [PATCH] [smithy-rs] Filter test inputs for presigning header exclusion proptest (#2986) ## Motivation and Context During our internal build, the `aws-sigv4` crate failed on a proptest as follows: ``` Diff < left / right > : content-length;content-type . minimal failing input: excluded_headers = [ "host", ] successes: 74 local rejects: 0 global rejects: 0 ', aws-sigv4/src/http_request/canonical_request.rs:838:5 failures: http_request::canonical_request::tests::presigning_header_exclusion_with_explicit_exclusion_list_specified ``` This says that `excluded_headers` should not contain `host`. To address it, this PR will filter out test inputs from proptest that contain `content-length`, `content-type`, or `host` (all of which appear in the expected value for the test at line 886 in the new revision). ## Testing No new tests have been added, relied on the existing tests in CI ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --- .../src/http_request/canonical_request.rs | 21 +++++++++++++++---- versions.toml | 4 ++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/sdk/aws-sigv4/src/http_request/canonical_request.rs b/sdk/aws-sigv4/src/http_request/canonical_request.rs index 221463ada23d..b6f4ec1052a0 100644 --- a/sdk/aws-sigv4/src/http_request/canonical_request.rs +++ b/sdk/aws-sigv4/src/http_request/canonical_request.rs @@ -835,11 +835,24 @@ mod tests { ); } + fn valid_input(input: &Vec) -> bool { + [ + "content-length".to_owned(), + "content-type".to_owned(), + "host".to_owned(), + ] + .iter() + .all(|element| !input.contains(&element)) + } + proptest! { - #[test] - fn presigning_header_exclusion_with_explicit_exclusion_list_specified( - excluded_headers in prop::collection::vec("[a-z]{1,20}", 1..10), - ) { + #[test] + fn presigning_header_exclusion_with_explicit_exclusion_list_specified( + excluded_headers in prop::collection::vec("[a-z]{1,20}", 1..10).prop_filter( + "`excluded_headers` should pass the `valid_input` check", + valid_input, + ) + ) { let mut request_builder = http::Request::builder() .uri("https://some-endpoint.some-region.amazonaws.com") .header("content-type", "application/xml") diff --git a/versions.toml b/versions.toml index 96d377b61c10..c4e35ef38d8a 100644 --- a/versions.toml +++ b/versions.toml @@ -1,4 +1,4 @@ -smithy_rs_revision = 'cf95f4803aaad77197b3ce3a39570f85408bfd2a' +smithy_rs_revision = 'f982b40edb378ea54a697b1163490ad0096f2d88' aws_doc_sdk_examples_revision = '577a55916047897a0ef2e2aac1e855dccc3614f9' [manual_interventions] @@ -2152,7 +2152,7 @@ source_hash = 'a2dad573276654e47f5d3befb3f570f66f569d39c19dda0e468b7d2acb9cc020' [crates.aws-sigv4] category = 'AwsRuntime' version = '0.56.1' -source_hash = 'eac6c9c7b6dba8797de55acdba79dbf18b5ee91fb7d5e54cda289dd0ac346221' +source_hash = '03be96a75a27326060a77544c0072d31e78df71d7b54c04e7cbec7e7df536172' [crates.aws-smithy-async] category = 'SmithyRuntime'