Skip to content

Commit

Permalink
test: enable protocol tests blocked by previous versions
Browse files Browse the repository at this point in the history
  • Loading branch information
kuhe committed Sep 25, 2024
1 parent 1273ff3 commit dbc70f3
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,44 +305,17 @@ private static boolean filterProtocolTests(
HttpMessageTestCase testCase,
TypeScriptSettings settings
) {
// TODO: Remove when requestCompression has been implemented.
if (testCase.getId().startsWith("SDKAppliedContentEncoding_")
|| testCase.getId().startsWith("SDKAppendsGzipAndIgnoresHttpProvidedEncoding_")
|| testCase.getId().startsWith("SDKAppendedGzipAfterProvidedEncoding_")) {
return true;
}

// TODO: Remove when upstream tests update to serialize empty headers.
if (testCase.getId().contains("NullAndEmptyHeaders")) {
return true;
}

if (testCase.getTags().contains("defaults")) {
return true;
}

// TODO: remove when there's a decision on separator to use
// https://github.com/awslabs/smithy/issues/1014
if (testCase.getId().equals("RestJsonInputAndOutputWithQuotedStringHeaders")) {
return true;
}

// TODO: implementation change pending.
List<String> extraUnionKey = Arrays.asList(
"RestXmlHttpPayloadWithUnsetUnion",
"RestJsonHttpPayloadWithUnsetUnion"
);
if (extraUnionKey.contains(testCase.getId())) {
return true;
}

// TODO: remove when Glacier AccountID hyphen customization is implemented: SMITHY-2614
if (testCase.getId().equals("GlacierAccountId")) {
return true;
}

// ToDo: https://github.com/aws/aws-sdk-js-v3/issues/6246
if (testCase.getId().equals("RestJsonMustSupportParametersInContentType")) {
if (testCase.getTags().contains("defaults")) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ it("Ec2QueryNoInputAndOutput:Response", async () => {
/**
* Compression algorithm encoding is appended to the Content-Encoding header.
*/
it.skip("SDKAppliedContentEncoding_ec2Query:Request", async () => {
it("SDKAppliedContentEncoding_ec2Query:Request", async () => {
const client = new EC2ProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down Expand Up @@ -868,7 +868,7 @@ it.skip("SDKAppliedContentEncoding_ec2Query:Request", async () => {
* traits are ignored in the ec2Query protocol.
*
*/
it.skip("SDKAppendsGzipAndIgnoresHttpProvidedEncoding_ec2Query:Request", async () => {
it("SDKAppendsGzipAndIgnoresHttpProvidedEncoding_ec2Query:Request", async () => {
const client = new EC2ProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ it.skip("AwsJson10ClientErrorCorrectsWhenServerFailsToSerializeRequiredValues:Re
/**
* Compression algorithm encoding is appended to the Content-Encoding header.
*/
it.skip("SDKAppliedContentEncoding_awsJson1_0:Request", async () => {
it("SDKAppliedContentEncoding_awsJson1_0:Request", async () => {
const client = new JSONRPC10Client({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down Expand Up @@ -2784,7 +2784,7 @@ it.skip("SDKAppliedContentEncoding_awsJson1_0:Request", async () => {
* traits are ignored in the awsJson1_0 protocol.
*
*/
it.skip("SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_0:Request", async () => {
it("SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_0:Request", async () => {
const client = new JSONRPC10Client({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4410,7 +4410,7 @@ it("PutAndGetInlineDocumentsInput:Response", async () => {
/**
* Compression algorithm encoding is appended to the Content-Encoding header.
*/
it.skip("SDKAppliedContentEncoding_awsJson1_1:Request", async () => {
it("SDKAppliedContentEncoding_awsJson1_1:Request", async () => {
const client = new JsonProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down Expand Up @@ -4443,7 +4443,7 @@ it.skip("SDKAppliedContentEncoding_awsJson1_1:Request", async () => {
* traits are ignored in the awsJson1_1 protocol.
*
*/
it.skip("SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_1:Request", async () => {
it("SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsJson1_1:Request", async () => {
const client = new JsonProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ it("QueryNoInputAndOutput:Response", async () => {
/**
* Compression algorithm encoding is appended to the Content-Encoding header.
*/
it.skip("SDKAppliedContentEncoding_awsQuery:Request", async () => {
it("SDKAppliedContentEncoding_awsQuery:Request", async () => {
const client = new QueryProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down Expand Up @@ -1121,7 +1121,7 @@ it.skip("SDKAppliedContentEncoding_awsQuery:Request", async () => {
* traits are ignored in the awsQuery protocol.
*
*/
it.skip("SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsQuery:Request", async () => {
it("SDKAppendsGzipAndIgnoresHttpProvidedEncoding_awsQuery:Request", async () => {
const client = new QueryProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2695,7 +2695,7 @@ it("RestJsonHttpPayloadWithUnion:Request", async () => {
/**
* No payload is sent if the union has no value.
*/
it.skip("RestJsonHttpPayloadWithUnsetUnion:Request", async () => {
it("RestJsonHttpPayloadWithUnsetUnion:Request", async () => {
const client = new RestJsonProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down Expand Up @@ -2764,7 +2764,7 @@ it("RestJsonHttpPayloadWithUnion:Response", async () => {
/**
* No payload is sent if the union has no value.
*/
it.skip("RestJsonHttpPayloadWithUnsetUnion:Response", async () => {
it("RestJsonHttpPayloadWithUnsetUnion:Response", async () => {
const client = new RestJsonProtocolClient({
...clientParams,
requestHandler: new ResponseDeserializationTestHandler(
Expand Down Expand Up @@ -3440,7 +3440,7 @@ it("RestJsonInputAndOutputWithStringHeaders:Request", async () => {
/**
* Tests requests with string list header bindings that require quoting
*/
it.skip("RestJsonInputAndOutputWithQuotedStringHeaders:Request", async () => {
it("RestJsonInputAndOutputWithQuotedStringHeaders:Request", async () => {
const client = new RestJsonProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down Expand Up @@ -3804,7 +3804,7 @@ it("RestJsonInputAndOutputWithStringHeaders:Response", async () => {
/**
* Tests responses with string list header bindings that require quoting
*/
it.skip("RestJsonInputAndOutputWithQuotedStringHeaders:Response", async () => {
it("RestJsonInputAndOutputWithQuotedStringHeaders:Response", async () => {
const client = new RestJsonProtocolClient({
...clientParams,
requestHandler: new ResponseDeserializationTestHandler(true, 200, {
Expand Down Expand Up @@ -7853,7 +7853,7 @@ it("PostUnionWithJsonNameResponse3:Response", async () => {
/**
* Compression algorithm encoding is appended to the Content-Encoding header.
*/
it.skip("SDKAppliedContentEncoding_restJson1:Request", async () => {
it("SDKAppliedContentEncoding_restJson1:Request", async () => {
const client = new RestJsonProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down Expand Up @@ -7886,7 +7886,7 @@ it.skip("SDKAppliedContentEncoding_restJson1:Request", async () => {
* request compression encoding from the HTTP binding.
*
*/
it.skip("SDKAppendedGzipAfterProvidedEncoding_restJson1:Request", async () => {
it("SDKAppendedGzipAfterProvidedEncoding_restJson1:Request", async () => {
const client = new RestJsonProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand All @@ -7910,7 +7910,7 @@ it.skip("SDKAppendedGzipAfterProvidedEncoding_restJson1:Request", async () => {
expect(r.path).toBe("/requestcompression/putcontentwithencoding");

expect(r.headers["content-encoding"]).toBeDefined();
expect(r.headers["content-encoding"]).toBe("custom, gzip");
expect(r.headers["content-encoding"].replaceAll(", ", ",")).toBe("custom, gzip".replaceAll(", ", ","));
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1923,7 +1923,7 @@ it("RestXmlHttpPayloadWithUnion:Request", async () => {
/**
* No payload is sent if the union has no value.
*/
it.skip("RestXmlHttpPayloadWithUnsetUnion:Request", async () => {
it("RestXmlHttpPayloadWithUnsetUnion:Request", async () => {
const client = new RestXmlProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down Expand Up @@ -1992,7 +1992,7 @@ it("RestXmlHttpPayloadWithUnion:Response", async () => {
/**
* No payload is sent if the union has no value.
*/
it.skip("RestXmlHttpPayloadWithUnsetUnion:Response", async () => {
it("RestXmlHttpPayloadWithUnsetUnion:Response", async () => {
const client = new RestXmlProtocolClient({
...clientParams,
requestHandler: new ResponseDeserializationTestHandler(
Expand Down Expand Up @@ -3831,7 +3831,7 @@ it("RestXmlSerializesEmptyString:Request", async () => {
/**
* Compression algorithm encoding is appended to the Content-Encoding header.
*/
it.skip("SDKAppliedContentEncoding_restXml:Request", async () => {
it("SDKAppliedContentEncoding_restXml:Request", async () => {
const client = new RestXmlProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand Down Expand Up @@ -3864,7 +3864,7 @@ it.skip("SDKAppliedContentEncoding_restXml:Request", async () => {
* request compression encoding from the HTTP binding.
*
*/
it.skip("SDKAppendedGzipAfterProvidedEncoding_restXml:Request", async () => {
it("SDKAppendedGzipAfterProvidedEncoding_restXml:Request", async () => {
const client = new RestXmlProtocolClient({
...clientParams,
requestHandler: new RequestSerializationTestHandler(),
Expand All @@ -3888,7 +3888,7 @@ it.skip("SDKAppendedGzipAfterProvidedEncoding_restXml:Request", async () => {
expect(r.path).toBe("/requestcompression/putcontentwithencoding");

expect(r.headers["content-encoding"]).toBeDefined();
expect(r.headers["content-encoding"]).toBe("custom, gzip");
expect(r.headers["content-encoding"].replaceAll(", ", ",")).toBe("custom, gzip".replaceAll(", ", ","));
}
});

Expand Down
14 changes: 7 additions & 7 deletions private/aws-restjson-server/test/functional/restjson1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ it("RestJsonConstantQueryString:ServerRequest", async () => {
/**
* A server should ignore parameters added to the content type
*/
it.skip("RestJsonMustSupportParametersInContentType:ServerRequest", async () => {
it("RestJsonMustSupportParametersInContentType:ServerRequest", async () => {
const testFunction = jest.fn();
testFunction.mockReturnValue(Promise.resolve({}));
const testService: Partial<RestJsonService<{}>> = {
Expand Down Expand Up @@ -3089,7 +3089,7 @@ it("RestJsonHttpPayloadWithUnion:ServerRequest", async () => {
/**
* No payload is sent if the union has no value.
*/
it.skip("RestJsonHttpPayloadWithUnsetUnion:ServerRequest", async () => {
it("RestJsonHttpPayloadWithUnsetUnion:ServerRequest", async () => {
const testFunction = jest.fn();
testFunction.mockReturnValue(Promise.resolve({}));
const testService: Partial<RestJsonService<{}>> = {
Expand Down Expand Up @@ -3181,7 +3181,7 @@ it("RestJsonHttpPayloadWithUnion:ServerResponse", async () => {
/**
* No payload is sent if the union has no value.
*/
it.skip("RestJsonHttpPayloadWithUnsetUnion:ServerResponse", async () => {
it("RestJsonHttpPayloadWithUnsetUnion:ServerResponse", async () => {
class TestService implements Partial<RestJsonService<{}>> {
HttpPayloadWithUnion(input: any, ctx: {}): Promise<HttpPayloadWithUnionServerOutput> {
const response = {} as any;
Expand Down Expand Up @@ -4183,7 +4183,7 @@ it("RestJsonInputAndOutputWithStringHeaders:ServerRequest", async () => {
/**
* Tests requests with string list header bindings that require quoting
*/
it.skip("RestJsonInputAndOutputWithQuotedStringHeaders:ServerRequest", async () => {
it("RestJsonInputAndOutputWithQuotedStringHeaders:ServerRequest", async () => {
const testFunction = jest.fn();
testFunction.mockReturnValue(Promise.resolve({}));
const testService: Partial<RestJsonService<{}>> = {
Expand Down Expand Up @@ -4661,7 +4661,7 @@ it("RestJsonInputAndOutputWithStringHeaders:ServerResponse", async () => {
/**
* Tests responses with string list header bindings that require quoting
*/
it.skip("RestJsonInputAndOutputWithQuotedStringHeaders:ServerResponse", async () => {
it("RestJsonInputAndOutputWithQuotedStringHeaders:ServerResponse", async () => {
class TestService implements Partial<RestJsonService<{}>> {
InputAndOutputWithHeaders(input: any, ctx: {}): Promise<InputAndOutputWithHeadersServerOutput> {
const response = {
Expand Down Expand Up @@ -28798,7 +28798,7 @@ it("PostUnionWithJsonNameResponse3:ServerResponse", async () => {
/**
* Compression algorithm encoding is appended to the Content-Encoding header.
*/
it.skip("SDKAppliedContentEncoding_restJson1:ServerRequest", async () => {
it("SDKAppliedContentEncoding_restJson1:ServerRequest", async () => {
const testFunction = jest.fn();
testFunction.mockReturnValue(Promise.resolve({}));
const testService: Partial<RestJsonService<{}>> = {
Expand Down Expand Up @@ -28844,7 +28844,7 @@ it.skip("SDKAppliedContentEncoding_restJson1:ServerRequest", async () => {
* request compression encoding from the HTTP binding.
*
*/
it.skip("SDKAppendedGzipAfterProvidedEncoding_restJson1:ServerRequest", async () => {
it("SDKAppendedGzipAfterProvidedEncoding_restJson1:ServerRequest", async () => {
const testFunction = jest.fn();
testFunction.mockReturnValue(Promise.resolve({}));
const testService: Partial<RestJsonService<{}>> = {
Expand Down

0 comments on commit dbc70f3

Please sign in to comment.