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

test: enable protocol tests blocked by previous versions #6512

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -227,6 +227,6 @@ it("ApiGatewayAccept:Request", async () => {
expect(r.headers["accept"]).toBeDefined();
expect(r.headers["accept"]).toBe("application/json");

expect(r.body).toBeFalsy();
expect(!r.body || r.body === `{}`).toBeTruthy();
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ it("GlacierVersionHeader:Request", async () => {
expect(r.headers["x-amz-glacier-version"]).toBeDefined();
expect(r.headers["x-amz-glacier-version"]).toBe("2012-06-01");

expect(r.body).toBeFalsy();
expect(!r.body || r.body === `{}`).toBeTruthy();
}
});

Expand Down Expand Up @@ -311,7 +311,7 @@ it.skip("GlacierAccountId:Request", async () => {
expect(r.headers["x-amz-glacier-version"]).toBeDefined();
expect(r.headers["x-amz-glacier-version"]).toBe("2012-06-01");

expect(r.body).toBeFalsy();
expect(!r.body || r.body === `{}`).toBeTruthy();
}
});

Expand Down
34 changes: 19 additions & 15 deletions private/aws-protocoltests-restjson/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ import {
parseEpochTimestamp as __parseEpochTimestamp,
parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset,
parseRfc7231DateTime as __parseRfc7231DateTime,
quoteHeader as __quoteHeader,
resolvedPath as __resolvedPath,
serializeDateTime as __serializeDateTime,
serializeFloat as __serializeFloat,
splitEvery as __splitEvery,
splitHeader as __splitHeader,
strictParseByte as __strictParseByte,
strictParseDouble as __strictParseDouble,
strictParseFloat as __strictParseFloat,
Expand Down Expand Up @@ -1033,8 +1035,8 @@ export const se_InputAndOutputWithHeadersCommand = async (
],
[_xb_]: [() => isSerializableHeaderValue(input[_hTB]), () => input[_hTB]!.toString()],
[_xb__]: [() => isSerializableHeaderValue(input[_hFB]), () => input[_hFB]!.toString()],
[_xs__]: [() => isSerializableHeaderValue(input[_hSL]), () => (input[_hSL]! || []).join(", ")],
[_xs___]: [() => isSerializableHeaderValue(input[_hSS]), () => (input[_hSS]! || []).join(", ")],
[_xs__]: [() => isSerializableHeaderValue(input[_hSL]), () => (input[_hSL]! || []).map(__quoteHeader).join(", ")],
[_xs___]: [() => isSerializableHeaderValue(input[_hSS]), () => (input[_hSS]! || []).map(__quoteHeader).join(", ")],
[_xi_]: [
() => isSerializableHeaderValue(input[_hIL]),
() => (input[_hIL]! || []).map((_entry) => _entry.toString() as any).join(", "),
Expand All @@ -1048,7 +1050,7 @@ export const se_InputAndOutputWithHeadersCommand = async (
() => (input[_hTL]! || []).map((_entry) => __dateToUtcString(_entry).toString() as any).join(", "),
],
[_xe]: input[_hE]!,
[_xe_]: [() => isSerializableHeaderValue(input[_hEL]), () => (input[_hEL]! || []).join(", ")],
[_xe_]: [() => isSerializableHeaderValue(input[_hEL]), () => (input[_hEL]! || []).map(__quoteHeader).join(", ")],
[_xi__]: [() => isSerializableHeaderValue(input[_hIE]), () => input[_hIE]!.toString()],
[_xi___]: [
() => isSerializableHeaderValue(input[_hIEL]),
Expand Down Expand Up @@ -1987,7 +1989,7 @@ export const se_NullAndEmptyHeadersClientCommand = async (
const headers: any = map({}, isSerializableHeaderValue, {
[_xa]: input[_a]!,
[_xb____]: input[_b_]!,
[_xc]: [() => isSerializableHeaderValue(input[_c]), () => (input[_c]! || []).join(", ")],
[_xc]: [() => isSerializableHeaderValue(input[_c]), () => (input[_c]! || []).map(__quoteHeader).join(", ")],
});
b.bp("/NullAndEmptyHeadersClient");
let body: any;
Expand All @@ -2006,7 +2008,7 @@ export const se_NullAndEmptyHeadersServerCommand = async (
const headers: any = map({}, isSerializableHeaderValue, {
[_xa]: input[_a]!,
[_xb____]: input[_b_]!,
[_xc]: [() => isSerializableHeaderValue(input[_c]), () => (input[_c]! || []).join(", ")],
[_xc]: [() => isSerializableHeaderValue(input[_c]), () => (input[_c]! || []).map(__quoteHeader).join(", ")],
});
b.bp("/NullAndEmptyHeadersServer");
let body: any;
Expand Down Expand Up @@ -2910,8 +2912,10 @@ export const de_HttpPayloadWithUnionCommand = async (
const contents: any = map({
$metadata: deserializeMetadata(output),
});
const data: Record<string, any> | undefined = __expectUnion(await parseBody(output.body, context));
contents.nested = _json(data);
const data: Record<string, any> | undefined = await parseBody(output.body, context);
if (Object.keys(data ?? {}).length) {
contents.nested = __expectUnion(_json(data));
}
return contents;
};

Expand Down Expand Up @@ -3135,19 +3139,19 @@ export const de_InputAndOutputWithHeadersCommand = async (
[_hFB]: [() => void 0 !== output.headers[_xb__], () => __parseBoolean(output.headers[_xb__])],
[_hSL]: [
() => void 0 !== output.headers[_xs__],
() => (output.headers[_xs__] || "").split(",").map((_entry) => _entry.trim() as any),
() => __splitHeader(output.headers[_xs__] || "").map((_entry) => _entry.trim() as any),
],
[_hSS]: [
() => void 0 !== output.headers[_xs___],
() => (output.headers[_xs___] || "").split(",").map((_entry) => _entry.trim() as any),
() => __splitHeader(output.headers[_xs___] || "").map((_entry) => _entry.trim() as any),
],
[_hIL]: [
() => void 0 !== output.headers[_xi_],
() => (output.headers[_xi_] || "").split(",").map((_entry) => __strictParseInt32(_entry.trim()) as any),
() => __splitHeader(output.headers[_xi_] || "").map((_entry) => __strictParseInt32(_entry.trim()) as any),
],
[_hBL]: [
() => void 0 !== output.headers[_xb___],
() => (output.headers[_xb___] || "").split(",").map((_entry) => __parseBoolean(_entry.trim()) as any),
() => __splitHeader(output.headers[_xb___] || "").map((_entry) => __parseBoolean(_entry.trim()) as any),
],
[_hTL]: [
() => void 0 !== output.headers[_xt],
Expand All @@ -3159,12 +3163,12 @@ export const de_InputAndOutputWithHeadersCommand = async (
[_hE]: [, output.headers[_xe]],
[_hEL]: [
() => void 0 !== output.headers[_xe_],
() => (output.headers[_xe_] || "").split(",").map((_entry) => _entry.trim() as any),
() => __splitHeader(output.headers[_xe_] || "").map((_entry) => _entry.trim() as any),
],
[_hIE]: [() => void 0 !== output.headers[_xi__], () => __strictParseInt32(output.headers[_xi__])],
[_hIEL]: [
() => void 0 !== output.headers[_xi___],
() => (output.headers[_xi___] || "").split(",").map((_entry) => __strictParseInt32(_entry.trim()) as any),
() => __splitHeader(output.headers[_xi___] || "").map((_entry) => __strictParseInt32(_entry.trim()) as any),
],
});
await collectBody(output.body, context);
Expand Down Expand Up @@ -3967,7 +3971,7 @@ export const de_NullAndEmptyHeadersClientCommand = async (
[_b_]: [, output.headers[_xb____]],
[_c]: [
() => void 0 !== output.headers[_xc],
() => (output.headers[_xc] || "").split(",").map((_entry) => _entry.trim() as any),
() => __splitHeader(output.headers[_xc] || "").map((_entry) => _entry.trim() as any),
],
});
await collectBody(output.body, context);
Expand All @@ -3990,7 +3994,7 @@ export const de_NullAndEmptyHeadersServerCommand = async (
[_b_]: [, output.headers[_xb____]],
[_c]: [
() => void 0 !== output.headers[_xc],
() => (output.headers[_xc] || "").split(",").map((_entry) => _entry.trim() as any),
() => __splitHeader(output.headers[_xc] || "").map((_entry) => _entry.trim() as any),
],
});
await collectBody(output.body, context);
Expand Down
Loading
Loading