-
Notifications
You must be signed in to change notification settings - Fork 35
Add event stream protocol tests for client #1176
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| import java.nio.charset.StandardCharsets; | ||
| import software.amazon.smithy.java.io.ByteBufferUtils; | ||
| import software.amazon.smithy.java.io.datastream.DataStream; | ||
| import software.amazon.smithy.java.protocoltests.harness.EventStreamClientTests; | ||
| import software.amazon.smithy.java.protocoltests.harness.HttpClientRequestTests; | ||
| import software.amazon.smithy.java.protocoltests.harness.HttpClientResponseTests; | ||
| import software.amazon.smithy.java.protocoltests.harness.ProtocolTest; | ||
|
|
@@ -26,6 +27,40 @@ | |
| skipOperations = { | ||
| // We dont ignore defaults on input shapes | ||
| "aws.protocoltests.restjson#OperationWithDefaults", | ||
| }, | ||
| skipTests = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this list right? We had no exclusions before and now we have a ton?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of the skipped blob tests can be removed given that we released the change to update the test model. Will work on the remaining fixes later. |
||
| // Need to add exception type to header | ||
| "ClientErrorInput", | ||
| "DuplexClientErrorInput", | ||
| // Currently we are using JSON codec for plain text payload, need to correct it. | ||
| "StringPayloadOutput", | ||
| "DuplexStringPayloadOutput", | ||
| // eventstream:1.0.1 made ByteValue.encodeValue() and | ||
| // ShortValue.encodeValue() no-ops, producing malformed frames. | ||
| "ByteHeaderInput", | ||
| "DuplexByteHeaderInput", | ||
| "ShortHeaderInput", | ||
| "DuplexShortHeaderInput", | ||
| // Blob test params use inconsistent encoding conventions — | ||
| // headers use base64, payloads use raw strings. | ||
| "BlobPayloadInput", | ||
| "DuplexBlobPayloadInput", | ||
| "BlobPayloadOutput", | ||
| "DuplexBlobPayloadOutput", | ||
| "BlobHeaderInput", | ||
| "DuplexBlobHeaderInput", | ||
| "BlobHeaderOutput", | ||
| "DuplexBlobHeaderOutput", | ||
| "MultipleHeaderInput", | ||
| "DuplexMultipleHeaderInput", | ||
| "MultipleHeaderOutput", | ||
| "DuplexMultipleHeaderOutput", | ||
| // Decoder returns modeled error events instead of throwing | ||
| "ClientErrorOutput", | ||
| "DuplexClientErrorOutput", | ||
| // Client doesn't validate missing @required initial response members | ||
| "MissingRequiredInitialResponseOutput", | ||
| "DuplexMissingRequiredInitialResponseOutput" | ||
| }) | ||
| public class RestJson1ProtocolTests { | ||
| private static final String EMPTY_BODY = ""; | ||
|
|
@@ -57,4 +92,9 @@ public void requestTest(DataStream expected, DataStream actual) { | |
| public void responseTest(Runnable test) { | ||
| test.run(); | ||
| } | ||
|
|
||
| @EventStreamClientTests | ||
| public void eventStreamClientTest(Runnable test) { | ||
| test.run(); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package software.amazon.smithy.java.protocoltests.harness; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
| import org.junit.jupiter.api.TestTemplate; | ||
| import org.junit.jupiter.api.Timeout; | ||
| import org.junit.jupiter.api.extension.ExtendWith; | ||
| import org.junit.platform.commons.annotation.Testable; | ||
|
|
||
| @Target(ElementType.METHOD) | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @TestTemplate | ||
| @Testable | ||
| @Timeout(5) | ||
| @ExtendWith(EventStreamClientTestsProtocolTestProvider.class) | ||
| public @interface EventStreamClientTests {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this to prevent it from reading all the members in the structure, otherwise all header input tests would fail.
example structure: