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

Modify protocol test codegen #2242

Closed
wants to merge 11 commits into from
  •  
  •  
  •  
16 changes: 16 additions & 0 deletions .changelog/410d0cbaa49e46deb10a8e84915e474b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"id": "410d0cba-a49e-46de-b10a-8e84915e474b",
"type": "bugfix",
"collapse": true,
"description": "Modify protocol unit test cases to include endpoint and host label cases and deprecate local server dependency",
"modules": [
".",
"internal/protocoltest/awsrestjson",
"internal/protocoltest/ec2query",
"internal/protocoltest/jsonrpc",
"internal/protocoltest/jsonrpc10",
"internal/protocoltest/query",
"internal/protocoltest/restxml",
"internal/protocoltest/restxmlwithnamespace"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class AwsGoDependency {
null, Versions.INTERNAL_SIGV4A, "v4a");
public static final GoDependency S3_INTERNAL_ARN = aws("service/internal/s3shared/arn", "s3arn");
public static final GoDependency AWS_ARN = aws("aws/arn", "awsarn");

public static final GoDependency AWS_PROTOCOL_TEST_HTTP_CLIENT = aws("internal/protocoltest", "protocoltesthttp");

public static final GoDependency REGEXP = SmithyGoDependency.stdlib("regexp");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import java.util.Set;
import java.util.TreeSet;

import software.amazon.smithy.aws.go.codegen.customization.AwsCustomGoDependency;
import software.amazon.smithy.codegen.core.Symbol;
import software.amazon.smithy.go.codegen.GoWriter;
import software.amazon.smithy.go.codegen.SmithyGoDependency;
Expand Down Expand Up @@ -98,96 +100,12 @@ static void generateHttpProtocolTests(GenerationContext context) {
inputConfigValues.add(HttpProtocolUnitTestGenerator.ConfigValue.builder()
.name(AddAwsConfigFields.HTTP_CLIENT_CONFIG_NAME)
.value(writer -> {
writer.addUseImports(AwsGoDependency.AWS_HTTP_TRANSPORT);
writer.write("awshttp.NewBuildableClient(),");
writer.addUseImports(AwsGoDependency.AWS_PROTOCOL_TEST_HTTP_CLIENT);
writer.write("protocoltesthttp.NewClient(),");
})
.build());

Set<HttpProtocolUnitTestGenerator.SkipTest> inputSkipTests = new TreeSet<>(SetUtils.of(
// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
// e.g. http://foo.127.0.0.1:59850/ dial fail
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.restjson#RestJson"))
.operation(ShapeId.from("aws.protocoltests.restjson#EndpointOperation"))
.addTestName("RestJsonEndpointTrait")
.build(),
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.restjson#RestJson"))
.operation(ShapeId.from("aws.protocoltests.restjson#EndpointWithHostLabelOperation"))
.addTestName("RestJsonEndpointTraitWithHostLabel")
.build(),

// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
// e.g. http://foo.127.0.0.1:59850/ dial fail
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.ec2#AwsEc2"))
.operation(ShapeId.from("aws.protocoltests.ec2#EndpointOperation"))
.addTestName("Ec2QueryEndpointTrait")
.build(),
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.ec2#AwsEc2"))
.operation(ShapeId.from("aws.protocoltests.ec2#EndpointWithHostLabelOperation"))
.addTestName("Ec2QueryEndpointTraitWithHostLabel")
.build(),

// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
// e.g. http://foo.127.0.0.1:59850/ dial fail
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.json#JsonProtocol"))
.operation(ShapeId.from("aws.protocoltests.json#EndpointOperation"))
.addTestName("AwsJson11EndpointTrait")
.build(),
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.json#JsonProtocol"))
.operation(ShapeId.from("aws.protocoltests.json#EndpointWithHostLabelOperation"))
.addTestName("AwsJson11EndpointTraitWithHostLabel")
.build(),

// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
// e.g. http://foo.127.0.0.1:59850/ dial fail
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.json10#JsonRpc10"))
.operation(ShapeId.from("aws.protocoltests.json10#EndpointOperation"))
.addTestName("AwsJson10EndpointTrait")
.build(),
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.json10#JsonRpc10"))
.operation(ShapeId.from("aws.protocoltests.json10#EndpointWithHostLabelOperation"))
.addTestName("AwsJson10EndpointTraitWithHostLabel")
.build(),

// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
// e.g. http://foo.127.0.0.1:59850/ dial fail
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.query#AwsQuery"))
.operation(ShapeId.from("aws.protocoltests.query#EndpointOperation"))
.addTestName("AwsQueryEndpointTrait")
.build(),
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.query#AwsQuery"))
.operation(ShapeId.from("aws.protocoltests.query#EndpointWithHostLabelOperation"))
.addTestName("AwsQueryEndpointTraitWithHostLabel")
.build(),

// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
// e.g. http://foo.127.0.0.1:59850/ dial fail
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.restxml#RestXml"))
.operation(ShapeId.from("aws.protocoltests.restxml#EndpointOperation"))
.addTestName("RestXmlEndpointTrait")
.build(),
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.restxml#RestXml"))
.operation(ShapeId.from("aws.protocoltests.restxml#EndpointWithHostLabelHeaderOperation"))
.addTestName("RestXmlEndpointTraitWithHostLabelAndHttpBinding")
.build(),
HttpProtocolUnitTestGenerator.SkipTest.builder()
.service(ShapeId.from("aws.protocoltests.restxml#RestXml"))
.operation(ShapeId.from("aws.protocoltests.restxml#EndpointWithHostLabelOperation"))
.addTestName("RestXmlEndpointTraitWithHostLabel")
.build()

));
Set<HttpProtocolUnitTestGenerator.SkipTest> inputSkipTests = new TreeSet<>(SetUtils.of());

Set<HttpProtocolUnitTestGenerator.SkipTest> outputSkipTests = new TreeSet<>(SetUtils.of(
// REST-JSON optional (SHOULD) test cases
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading