From fd845034bc276aaf913843d740eff77134913255 Mon Sep 17 00:00:00 2001 From: Jason Del Ponte <961963+jasdel@users.noreply.github.com> Date: Thu, 17 Mar 2022 15:14:57 -0700 Subject: [PATCH] codegen: Remove protocol test skipping for supported features. Updates the SDK's code generation of protocol test to no longer skip tests for features that are supported by the SDK. --- .../aws/go/codegen/AwsProtocolUtils.java | 66 +++++-------------- 1 file changed, 18 insertions(+), 48 deletions(-) diff --git a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsProtocolUtils.java b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsProtocolUtils.java index ae21dda62a9..ee924790785 100644 --- a/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsProtocolUtils.java +++ b/codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsProtocolUtils.java @@ -104,12 +104,8 @@ static void generateHttpProtocolTests(GenerationContext context) { .build()); Set inputSkipTests = new TreeSet<>(SetUtils.of( - // Smithy 1.6 changed unit tests that the SDK codegen don't support or are opinionated. - HttpProtocolUnitTestGenerator.SkipTest.builder() - .service(ShapeId.from("aws.protocoltests.restjson#RestJson")) - .operation(ShapeId.from("aws.protocoltests.restjson#EmptyInputAndEmptyOutput")) - .addTestName("RestJsonEmptyInputAndEmptyOutputWithJson") - .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.restjson#RestJson")) .operation(ShapeId.from("aws.protocoltests.restjson#EndpointOperation")) @@ -120,6 +116,9 @@ static void generateHttpProtocolTests(GenerationContext context) { .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")) @@ -130,11 +129,9 @@ static void generateHttpProtocolTests(GenerationContext context) { .operation(ShapeId.from("aws.protocoltests.ec2#EndpointWithHostLabelOperation")) .addTestName("Ec2QueryEndpointTraitWithHostLabel") .build(), - HttpProtocolUnitTestGenerator.SkipTest.builder() - .service(ShapeId.from("aws.protocoltests.json#JsonProtocol")) - .operation(ShapeId.from("aws.protocoltests.json#EmptyOperation")) - .addTestName("json_1_1_service_supports_empty_payload_for_no_input_shape") - .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")) @@ -145,11 +142,9 @@ static void generateHttpProtocolTests(GenerationContext context) { .operation(ShapeId.from("aws.protocoltests.json#EndpointWithHostLabelOperation")) .addTestName("AwsJson11EndpointTraitWithHostLabel") .build(), - HttpProtocolUnitTestGenerator.SkipTest.builder() - .service(ShapeId.from("aws.protocoltests.json10#JsonRpc10")) - .operation(ShapeId.from("aws.protocoltests.json10#NoInputAndNoOutput")) - .addTestName("AwsJson10ServiceSupportsNoPayloadForNoInput") - .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")) @@ -160,6 +155,9 @@ static void generateHttpProtocolTests(GenerationContext context) { .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")) @@ -170,6 +168,9 @@ static void generateHttpProtocolTests(GenerationContext context) { .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")) @@ -184,39 +185,8 @@ static void generateHttpProtocolTests(GenerationContext context) { .service(ShapeId.from("aws.protocoltests.restxml#RestXml")) .operation(ShapeId.from("aws.protocoltests.restxml#EndpointWithHostLabelOperation")) .addTestName("RestXmlEndpointTraitWithHostLabel") - .build(), - - // Null lists/maps without sparse tag - HttpProtocolUnitTestGenerator.SkipTest.builder() - .service(ShapeId.from("aws.protocoltests.restjson#RestJson")) - .operation(ShapeId.from("aws.protocoltests.restjson#JsonLists")) - .addTestName("RestJsonListsSerializeNull") - .build(), - HttpProtocolUnitTestGenerator.SkipTest.builder() - .service(ShapeId.from("aws.protocoltests.restjson#RestJson")) - .operation(ShapeId.from("aws.protocoltests.restjson#JsonMaps")) - .addTestName("RestJsonSerializesNullMapValues") - .build(), - HttpProtocolUnitTestGenerator.SkipTest.builder() - .service(ShapeId.from("aws.protocoltests.json#JsonProtocol")) - .operation(ShapeId.from("aws.protocoltests.json#NullOperation")) - .addTestName("AwsJson11MapsSerializeNullValues") - .addTestName("AwsJson11ListsSerializeNull") - .build(), - - // JSON RPC serialize empty modeled input should always serialize something - HttpProtocolUnitTestGenerator.SkipTest.builder() - .service(ShapeId.from("aws.protocoltests.json10#JsonRpc10")) - .operation(ShapeId.from("aws.protocoltests.json10#EmptyInputAndEmptyOutput")) - .addTestName("AwsJson10EmptyInputAndEmptyOutput") - .build(), - - // HTTP Payload Values that are unset vs set by the customer and how content-type should be handled. - HttpProtocolUnitTestGenerator.SkipTest.builder() - .service(ShapeId.from("aws.protocoltests.restjson#RestJson")) - .operation(ShapeId.from("aws.protocoltests.restjson#TestPayloadBlob")) - .addTestName("RestJsonHttpWithEmptyBlobPayload") .build() + )); Set outputSkipTests = new TreeSet<>(SetUtils.of(