Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate http test utils to new http-client crate #3888

Merged
merged 13 commits into from
Oct 23, 2024
Merged

Conversation

aajtodd
Copy link
Contributor

@aajtodd aajtodd commented Oct 21, 2024

Motivation and Context

Previous PR(s):
* #3866

Description

This PR migrates all of the HTTP related test-util feature to the new aws-smithy-http-client crate.

  • Re-export the relocated types from aws-smithy-runtime. I've tried to ensure the feature gates line up correctly to what was there before. All existing code depending on the test-util feature compiles and runs still in smithy-rs.
  • Updated the internals of all test-util code to be based on hyper-1 / http-1.
  • There were two functions legacy_infallible::infallible_client_fn and legacy_capture_request that I had to just duplicate with the legacy types to avoid a breaking change to them. These will be re-exported from aws-smithy-runtime as the original types but otherwise not be used going forward.

Next steps:

  • Deprecate the old test-util APIs and update all of our usage of test-util to be based on the new API's in aws-smithy-http-client. I may ask for team to help in this effort as it should be relatively straight forward migration work.

Checklist

  • For changes to the smithy-rs codegen or runtime crates, I have created a changelog entry Markdown file in the .changelog directory, specifying "client," "server," or both in the applies_to key.
  • 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.

@aajtodd aajtodd requested a review from a team as a code owner October 21, 2024 20:25
Copy link

A new generated diff is ready to view.

  • AWS SDK (ignoring whitespace)
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

  • AWS SDK (ignoring whitespace)
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

  • AWS SDK (ignoring whitespace)
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link
Contributor

@landonxjames landonxjames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! The only CI failure that still seems relevant is the external types failures

@aajtodd aajtodd requested a review from a team as a code owner October 23, 2024 18:12
Copy link

A new generated diff is ready to view.

  • AWS SDK (ignoring whitespace)
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

  • AWS SDK (ignoring whitespace)
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

@aajtodd aajtodd merged commit 94c242b into hyper1 Oct 23, 2024
41 of 44 checks passed
@aajtodd aajtodd deleted the atodd/http-test-utils branch October 23, 2024 19:43
aajtodd added a commit that referenced this pull request Nov 8, 2024
## Motivation and Context
Follow up PR to #3888

## Description
* Update `aws/sdk/integration-tests` to use the `test-util` feature(s)
directly from `aws-smithy-http-client` rather than `aws-smithy-runtime`
* ~Refactor `aws-smithy-http` to use `http-1.x~
* Fixed an erroneous error message from `imds` credentials provider in
passing while tracking down a test failure
* Fixed a few tests that were not immune to environment variables (e.g.
on dev desktop `AWS_EC2_METADATA_ENABLED=false` is set by default and
was causing some test failures)

I started pulling at some threads and found them to be quite load
bearing (e.g. `inlineable/serialization_settings.rs`) and would require
updating all of codegen to use `http-1.x`. ~This PR is a bit of a half
step with some stop gaps put into place (e.g. the new `compat` feature
of `aws-smithy-http` or inlining a function) to prevent the need to
update everything in a single PR. Future PR's will continue where I left
off here. ~

One lesson I learned the hard way was that our integration test
`Cargo.toml` have to reflect codegen. I had updated them to all use
`http = "1"` and got it all working only to realize codegen generates
`http = "0.2.9"` and `http-1x = { package = "http", version = "1"}` and
thus the integration tests have to look the same as that.

### Future

* ~Continue to refactor `aws-smithy-http` to upgrade to `http-body-1.x`.
~
* Refactor codegen to update to `http-1.x`

UPDATE: I reverted the update to http 1.x for `aws-smithy-http`. This
needs to be done and planned with the server and I don't want it to
unnecessarily block hyper 1. We will pursue the remaining hyper 1
changes and then make a decision on internal use of http and http-body
pre 1.x usage.

----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants