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

Run HttpMalformedRequest tests through router #1904

Merged
merged 30 commits into from
Oct 31, 2022

Conversation

jjant
Copy link
Contributor

@jjant jjant commented Oct 25, 2022

Motivation and Context

Addresses #1212.

Testing

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -842,7 +846,7 @@ class ServerProtocolTestGenerator(
private fun assertOk(rustWriter: RustWriter, inner: Writable) {
rustWriter.rust("#T(", RuntimeType.ProtocolTestHelper(codegenContext.runtimeConfig, "assert_ok"))
inner(rustWriter)
rustWriter.rust(");")
rustWriter.write(");")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using rustWriter.rust here caused IntelliJ to report an error because ); is not a valid rust snippet.

@jjant jjant marked this pull request as ready for review October 25, 2022 13:25
@jjant jjant requested a review from a team as a code owner October 25, 2022 13:25
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link
Contributor

@hlbarber hlbarber left a comment

Choose a reason for hiding this comment

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

There's also a checkRequest2 function which exercises the new service builder API.

.get::<#{SmithyHttpServer}::extension::OperationExtension>()
.expect("extension `OperationExtension` not found");
#{AssertEq}(operation_extension.absolute(), operation_full_name);
// let operation_extension = http_response.extensions()
Copy link
Contributor

Choose a reason for hiding this comment

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

This check ensures that the request has been successfully been routed by checking for OperationExtension set by the Handler implementation - looks like we're missing this assertion now?

This assertion won't succeed if the request fails to parse, which is why I guess it's commented out here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I was figuring out how that worked. I've re-added it for (non-malformed) request tests here: db95341.

Copy link
Contributor

Choose a reason for hiding this comment

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

The equivalent check in checkRequest2 is done by a channel fired in the handler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 6e1d747. I attempted to unify both approaches (checking operation extension vs using a channel in the handler) but ran into many type errors in the way.
I decided to revisit this later.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

jjant added 3 commits October 25, 2022 16:15
- Remove `checkRequest`, `checkRequest2` in favour
  of using `makeRequest`/`makeRequest2` directly
- Run service builder tests for MalformedHttpRequest tests
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@jjant jjant force-pushed the jjant/run-tests-against-services branch from 742216a to fb11a3e Compare October 27, 2022 13:39
@jjant jjant requested a review from a team as a code owner October 27, 2022 13:39
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Marks these two tests as failing:
  - RestJsonWithPayloadExpectsImpliedContentType
  - RestJsonBodyMalformedMapNullKey
These will be fixed in smithy-lang/smithy#1477.
Copy link
Contributor

@hlbarber hlbarber left a comment

Choose a reason for hiding this comment

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

This is more readable in general too. Thanks.

@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@jjant jjant merged commit 5eb3c82 into main Oct 31, 2022
@jjant jjant deleted the jjant/run-tests-against-services branch October 31, 2022 14:07
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.

2 participants