Skip to content
Unverified Commit 3ef75af7 authored by Aaron Todd's avatar Aaron Todd Committed by GitHub
Browse files

fix sigv4 canonical request order and revamp test suite (#4237)

## Description
Started as an investigation of
https://github.com/smithy-lang/smithy-rs/issues/4227.

I found that we 1. weren't utilizing most of our test suite (we only
used 4 of the test directories from the v4 suite) and 2. that we had a
bug in our canonical request implementation where we sort the query keys
before encoding instead of after (see
https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-create-signed-request.html#create-canonical-request
and the `get-vanilla-query-order-encoded` test).


This PR does a few things:
1. Imported the CRT test suite and removed the old ones.
* The previous test suite we were using is the older format that was in
use and floating around before CRT updated it. The newer version of this
has standardized the file format and includes both header and query
versions of each test.
* We were already using this format for the sigv4a tests so now all of
our tests for v4 and v4a use the same format. It also has a few
additional tests we didn't have.
* Using the same format as CRT (and Kotlin) will make it easier to
update the test suite or add new tests
3. Updates the test utils to be common across v4 and v4a. 
4. Added new test cases we weren't running for both v4 and v4a. Also
every test now generally tests both headers and query signature
locations (before we were only testing for headers most of the time).
5. Fixed a bug in canonical request implementation where we sort the
query keys before encoding instead of after (found by new test and
pointed out by engineer on ARC team as well).
6. Migrated a few tests `double-encode-path` and `double-url-encode`
that we used in several places to the newer format (only for headers not
query which was missing).
7. Inlined the `iam` related test request where it is used
8. Added a new `insert_encoded` for `QueryWriter` to append an already
encoded key/value pair and skip encoding.

## Testing
* During the migration I kept both the old and new test suites around.
Then removed the old suite after verifying the tests that utilized the
same files still passed on the new test suite.

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] For changes to the AWS SDK, generated SDK code, or SDK runtime
crates, I have created a changelog entry Markdown file in the
`.changelog` directory, specifying "aws-sdk-rust" in the `applies_to`
key.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent e478e312
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment