Skip to content

Commit 5d3382b

Browse files
authored
Merge pull request #2243 from aws/feat-protocol-test-2
feat: protocoltest: enable endpoint tests
2 parents f58ddae + 37347b1 commit 5d3382b

File tree

145 files changed

+1443
-3622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+1443
-3622
lines changed

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ tidy-modules-. add-module-license-files gen-aws-ptrs format
8686

8787
generate-tmpreplace-smithy: smithy-generate update-requires gen-repo-mod-replace update-module-metadata smithy-annotate-stable \
8888
gen-config-asserts gen-internal-codegen copy-attributevalue-feature gen-mod-replace-smithy-. min-go-version-. \
89-
tidy-modules-. add-module-license-files gen-aws-ptrs format gen-mod-dropreplace-smithy-.
89+
tidy-modules-. add-module-license-files gen-aws-ptrs format gen-mod-dropreplace-smithy-. reset-sum
90+
91+
reset-sum:
92+
find . -name go.sum -exec git checkout -- {} \;
9093

9194
smithy-generate:
9295
cd codegen && ./gradlew clean build -Plog-tests && ./gradlew clean

ci-find-smithy-go.sh

+7
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,19 @@ if [ "$branch" == main ]; then
2424
exit 0
2525
fi
2626

27+
# For PR workflows, only the triggering ref is checked out, which in isolation
28+
# is not recognized as a branch by git. Use the specific workflow env instead.
29+
if [ -z "$branch" ]; then
30+
branch=$GITHUB_HEAD_REF
31+
fi
32+
2733
if [ -n "$GIT_PAT" ]; then
2834
repository=https://$GIT_PAT@github.com/$SMITHY_GO_REPOSITORY
2935
else
3036
repository=https://github.com/$SMITHY_GO_REPOSITORY
3137
fi
3238

39+
echo on branch \"$branch\"
3340
while [ -n "$branch" ] && [[ "$branch" == *-* ]]; do
3441
echo looking for $branch...
3542
git ls-remote --exit-code --heads $repository refs/heads/$branch

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsGoDependency.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class AwsGoDependency {
5757
null, Versions.INTERNAL_SIGV4A, "v4a");
5858
public static final GoDependency S3_INTERNAL_ARN = aws("service/internal/s3shared/arn", "s3arn");
5959
public static final GoDependency AWS_ARN = aws("aws/arn", "awsarn");
60-
60+
public static final GoDependency AWS_PROTOCOL_TEST_HTTP_CLIENT = aws("internal/protocoltest", "protocoltesthttp");
6161

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

codegen/smithy-aws-go-codegen/src/main/java/software/amazon/smithy/aws/go/codegen/AwsProtocolUtils.java

+5-87
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
import java.util.Set;
1919
import java.util.TreeSet;
20+
21+
import software.amazon.smithy.aws.go.codegen.customization.AwsCustomGoDependency;
2022
import software.amazon.smithy.codegen.core.Symbol;
2123
import software.amazon.smithy.go.codegen.GoWriter;
2224
import software.amazon.smithy.go.codegen.SmithyGoDependency;
@@ -98,96 +100,12 @@ static void generateHttpProtocolTests(GenerationContext context) {
98100
inputConfigValues.add(HttpProtocolUnitTestGenerator.ConfigValue.builder()
99101
.name(AddAwsConfigFields.HTTP_CLIENT_CONFIG_NAME)
100102
.value(writer -> {
101-
writer.addUseImports(AwsGoDependency.AWS_HTTP_TRANSPORT);
102-
writer.write("awshttp.NewBuildableClient(),");
103+
writer.addUseImports(AwsGoDependency.AWS_PROTOCOL_TEST_HTTP_CLIENT);
104+
writer.write("protocoltesthttp.NewClient(),");
103105
})
104106
.build());
105107

106-
Set<HttpProtocolUnitTestGenerator.SkipTest> inputSkipTests = new TreeSet<>(SetUtils.of(
107-
// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
108-
// e.g. http://foo.127.0.0.1:59850/ dial fail
109-
HttpProtocolUnitTestGenerator.SkipTest.builder()
110-
.service(ShapeId.from("aws.protocoltests.restjson#RestJson"))
111-
.operation(ShapeId.from("aws.protocoltests.restjson#EndpointOperation"))
112-
.addTestName("RestJsonEndpointTrait")
113-
.build(),
114-
HttpProtocolUnitTestGenerator.SkipTest.builder()
115-
.service(ShapeId.from("aws.protocoltests.restjson#RestJson"))
116-
.operation(ShapeId.from("aws.protocoltests.restjson#EndpointWithHostLabelOperation"))
117-
.addTestName("RestJsonEndpointTraitWithHostLabel")
118-
.build(),
119-
120-
// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
121-
// e.g. http://foo.127.0.0.1:59850/ dial fail
122-
HttpProtocolUnitTestGenerator.SkipTest.builder()
123-
.service(ShapeId.from("aws.protocoltests.ec2#AwsEc2"))
124-
.operation(ShapeId.from("aws.protocoltests.ec2#EndpointOperation"))
125-
.addTestName("Ec2QueryEndpointTrait")
126-
.build(),
127-
HttpProtocolUnitTestGenerator.SkipTest.builder()
128-
.service(ShapeId.from("aws.protocoltests.ec2#AwsEc2"))
129-
.operation(ShapeId.from("aws.protocoltests.ec2#EndpointWithHostLabelOperation"))
130-
.addTestName("Ec2QueryEndpointTraitWithHostLabel")
131-
.build(),
132-
133-
// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
134-
// e.g. http://foo.127.0.0.1:59850/ dial fail
135-
HttpProtocolUnitTestGenerator.SkipTest.builder()
136-
.service(ShapeId.from("aws.protocoltests.json#JsonProtocol"))
137-
.operation(ShapeId.from("aws.protocoltests.json#EndpointOperation"))
138-
.addTestName("AwsJson11EndpointTrait")
139-
.build(),
140-
HttpProtocolUnitTestGenerator.SkipTest.builder()
141-
.service(ShapeId.from("aws.protocoltests.json#JsonProtocol"))
142-
.operation(ShapeId.from("aws.protocoltests.json#EndpointWithHostLabelOperation"))
143-
.addTestName("AwsJson11EndpointTraitWithHostLabel")
144-
.build(),
145-
146-
// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
147-
// e.g. http://foo.127.0.0.1:59850/ dial fail
148-
HttpProtocolUnitTestGenerator.SkipTest.builder()
149-
.service(ShapeId.from("aws.protocoltests.json10#JsonRpc10"))
150-
.operation(ShapeId.from("aws.protocoltests.json10#EndpointOperation"))
151-
.addTestName("AwsJson10EndpointTrait")
152-
.build(),
153-
HttpProtocolUnitTestGenerator.SkipTest.builder()
154-
.service(ShapeId.from("aws.protocoltests.json10#JsonRpc10"))
155-
.operation(ShapeId.from("aws.protocoltests.json10#EndpointWithHostLabelOperation"))
156-
.addTestName("AwsJson10EndpointTraitWithHostLabel")
157-
.build(),
158-
159-
// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
160-
// e.g. http://foo.127.0.0.1:59850/ dial fail
161-
HttpProtocolUnitTestGenerator.SkipTest.builder()
162-
.service(ShapeId.from("aws.protocoltests.query#AwsQuery"))
163-
.operation(ShapeId.from("aws.protocoltests.query#EndpointOperation"))
164-
.addTestName("AwsQueryEndpointTrait")
165-
.build(),
166-
HttpProtocolUnitTestGenerator.SkipTest.builder()
167-
.service(ShapeId.from("aws.protocoltests.query#AwsQuery"))
168-
.operation(ShapeId.from("aws.protocoltests.query#EndpointWithHostLabelOperation"))
169-
.addTestName("AwsQueryEndpointTraitWithHostLabel")
170-
.build(),
171-
172-
// Endpoint prefix serialization doesn't work with test runner's handling of request URLs.
173-
// e.g. http://foo.127.0.0.1:59850/ dial fail
174-
HttpProtocolUnitTestGenerator.SkipTest.builder()
175-
.service(ShapeId.from("aws.protocoltests.restxml#RestXml"))
176-
.operation(ShapeId.from("aws.protocoltests.restxml#EndpointOperation"))
177-
.addTestName("RestXmlEndpointTrait")
178-
.build(),
179-
HttpProtocolUnitTestGenerator.SkipTest.builder()
180-
.service(ShapeId.from("aws.protocoltests.restxml#RestXml"))
181-
.operation(ShapeId.from("aws.protocoltests.restxml#EndpointWithHostLabelHeaderOperation"))
182-
.addTestName("RestXmlEndpointTraitWithHostLabelAndHttpBinding")
183-
.build(),
184-
HttpProtocolUnitTestGenerator.SkipTest.builder()
185-
.service(ShapeId.from("aws.protocoltests.restxml#RestXml"))
186-
.operation(ShapeId.from("aws.protocoltests.restxml#EndpointWithHostLabelOperation"))
187-
.addTestName("RestXmlEndpointTraitWithHostLabel")
188-
.build()
189-
190-
));
108+
Set<HttpProtocolUnitTestGenerator.SkipTest> inputSkipTests = new TreeSet<>(SetUtils.of());
191109

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

internal/protocoltest/awsrestjson/api_op_AllQueryStringTypes_test.go

+10-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/protocoltest/awsrestjson/api_op_ConstantAndVariableQueryString_test.go

+10-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/protocoltest/awsrestjson/api_op_ConstantQueryString_test.go

+10-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)