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

Lack of coverage in RPC v2 CBOR protocol test suite #2325

Open
1 of 9 tasks
david-perez opened this issue Jun 13, 2024 · 2 comments
Open
1 of 9 tasks

Lack of coverage in RPC v2 CBOR protocol test suite #2325

david-perez opened this issue Jun 13, 2024 · 2 comments

Comments

@david-perez
Copy link
Contributor

david-perez commented Jun 13, 2024

I'll use this issue to track lack of coverage in the RPC v2 CBOR protocol test suite: https://github.com/smithy-lang/smithy/tree/main/smithy-protocol-tests/model/rpcv2Cbor; I'll update the issue description as I find issues when finishing my implementation.

  • union shapes
    • Containing members targeting Unit.
    • Containing all members targeting Unit.
    • Ensuring that unknown variants are rejected by the server but accepted by the client.
    • Testing both fixed-length and variable-length map encodings.
  • structure shapes
  • Forbid X-Amzn-Target header in requests.
  • Forbid X-Amzn-ErrorType header in responses.
  • Test operation error serialization, ensuring __type is serialized as expected.
    • Ensure that __type field is only added by servers in top-level structure shapes corresponding to error responses, not by clients, and not if the error shape is reused elsewhere.
  • Server routing tests, rejecting requests with:
    • unroutable URIs (operation not found).
    • missing or invalid Smithy-Protocol and Content-Type headers.
    • forbidden headers (x-amz-target or x-amzn-target).
    • invalid HTTP verbs (only POST is allowed).
  • There's no @httpMalformedRequestTests.
    • Constraint traits (including @required).
    • Content-Type and Accept header checking.
    • Test that a malformed CBOR data item gets rejected.
    • Test that servers reject upon encountering first null value in a non-@sparse list/map.
  • Test response HTTP status codes, honoring the only supported HTTP binding trait, @httpError.
@mullermp
Copy link
Contributor

Should there be a test similar to "RpcV2CborDeserializesDenseSetMapAndSkipsNull" for lists?

@drganjoo
Copy link

Ignore unknown members

We have the following tests to check servers and clients ignore unknown members:

For clients:RpcV2CborExtraFieldsInTheBodyShouldBeSkippedByClients

{_
    "byteValue": 5,
    "doubleValue": 1.889_3,
    "falseBooleanValue": false,
    "floatValue": 7.625_2,
    "extraObject": {_
        "indefiniteLengthMap": {_ "withAnArray": [_ 1, 2, 3]},
        "definiteLengthMap": {
            "withADefiniteArray": [1, 2, 3],
            "andSomeIndefiniteLengthString": "that has, been chunked on comma",
            "normalString": "foo",
        },
        "shortValue": 9999_1,
        "someOtherField": "this should be skipped",
    },
    "integerValue": 256_1,
    "longValue": 9873_1,
    "shortValue": 9898_1,
    "stringValue": "simple",
    "trueBooleanValue": true,
    "blobValue": h'666f6f',
}

For servers: RpcV2CborExtraFieldsInTheBodyShouldBeSkippedByServers:

{_
    "byteValue": 5,
    "doubleValue": 1.889_3,
    "falseBooleanValue": false,
    "floatValue": 7.625_2,
    "extraObject": {_
        "indefiniteLengthMap": {_ "withAnArray": [_ 1, 2, 3]},
        "definiteLengthMap": {
            "withADefiniteArray": [1, 2, 3],
            "andSomeIndefiniteLengthString": "that has, been chunked on comma",
            "normalString": "foo",
        },
        "shortValue": 9999_1,
        "someOtherField": "this should be skipped",
    },
    "integerValue": 256_1,
    "longValue": 9873_1,
    "shortValue": 9898_1,
    "stringValue": "simple",
    "trueBooleanValue": true,
    "blobValue": h'666f6f',
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants