Skip to content

Commit 624daad

Browse files
Add docs for the endpointTests trait
1 parent 936509a commit 624daad

2 files changed

Lines changed: 181 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "documentation",
3+
"description": "Added docs for the endpointTests trait.",
4+
"pull_requests": []
5+
}

docs/source-2.0/additional-specs/rules-engine/specification.rst

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,5 +921,181 @@ The following two expressions are equivalent:
921921
]
922922
}
923923
924+
925+
.. smithy-trait:: smithy.rules#endpointTests
926+
.. _smithy.rules#endpointTests-trait:
927+
928+
------------------------------------
929+
``smithy.rules#endpointTests`` trait
930+
------------------------------------
931+
932+
.. warning:: Experimental
933+
934+
This trait is experimental and subject to change.
935+
936+
Summary
937+
Defines endpoint test cases for validating a client's endpoint rule-set.
938+
Test cases assert that given a set of parameter values, the rule set
939+
resolves to an expected endpoint or error.
940+
Trait selector
941+
``service :is([trait|smithy.rules#endpointRuleSet], [trait|smithy.rules#endpointBdd])``
942+
943+
*A service with the :ref:`endpointRuleSet <smithy.rules#endpointRuleSet-trait>`
944+
or :ref:`endpointBdd <smithy.rules#endpointBdd-trait>` trait.*
945+
Value type
946+
``structure``
947+
948+
The ``endpointTests`` trait is a structure that supports the following members:
949+
950+
.. list-table::
951+
:header-rows: 1
952+
:widths: 10 30 60
953+
954+
* - Property name
955+
- Type
956+
- Description
957+
* - version
958+
- ``string``
959+
- **Required**. The endpoint tests schema version.
960+
* - testCases
961+
- ``[`` `EndpointTest object`_ ``]``
962+
- A list of endpoint test case definitions.
963+
964+
The following example defines an endpoint test that expects an endpoint URL
965+
to be based on configured region parameter.
966+
967+
.. code-block:: smithy
968+
969+
@endpointTests(
970+
version: "1.0"
971+
testCases: [
972+
{
973+
"params": {
974+
"Region": "north-america-1"
975+
}
976+
"expect": {
977+
"endpoint": {
978+
"url": "https://north-america-1.example.com"
979+
}
980+
}
981+
}
982+
]
983+
)
984+
985+
986+
.. _rules-engine-endpoint-test:
987+
988+
EndpointTest object
989+
-------------------
990+
991+
An endpoint test case describes a set of inputs and the expected outcome of
992+
evaluating the rule set. The ``EndpointTest`` object supports the following
993+
members:
994+
995+
.. list-table::
996+
:header-rows: 1
997+
:widths: 10 30 60
998+
999+
* - Property name
1000+
- Type
1001+
- Description
1002+
* - documentation
1003+
- ``string``
1004+
- A description of the test case.
1005+
* - params
1006+
- ``document``
1007+
- Defines rule-set parameter names and their values to use when
1008+
evaluating the rule set.
1009+
* - operationInputs
1010+
- ``[`` `OperationInput object`_ ``]``
1011+
- A list of service operation configurations used for testing the
1012+
rules engine. Each entry describes an operation invocation whose
1013+
input is used to bind parameter values.
1014+
* - expect
1015+
- `EndpointTestExpectation union`_
1016+
- **Required**. The expected outcome of evaluating the rule set with
1017+
the given parameters.
1018+
1019+
1020+
.. _rules-engine-endpoint-test-operation-input:
1021+
1022+
OperationInput object
1023+
---------------------
1024+
1025+
An ``OperationInput`` object describes a service operation and the input used
1026+
to verify an endpoint rule-set test case. It supports the following members:
1027+
1028+
.. list-table::
1029+
:header-rows: 1
1030+
:widths: 10 30 60
1031+
1032+
* - Property name
1033+
- Type
1034+
- Description
1035+
* - operationName
1036+
- ``string``
1037+
- **Required**. The name of the service operation targeted by the test.
1038+
* - operationParams
1039+
- ``document``
1040+
- Input parameters used to generate the operation request. These
1041+
parameters MUST be compatible with the input of the operation.
1042+
* - builtInParams
1043+
- ``document``
1044+
- Rule-set built-in values and their corresponding values to be set.
1045+
* - clientParams
1046+
- ``document``
1047+
- Client configuration parameters to be set.
1048+
1049+
1050+
.. _rules-engine-endpoint-test-expectation:
1051+
1052+
EndpointTestExpectation union
1053+
-----------------------------
1054+
1055+
The ``EndpointTestExpectation`` union describes the expected outcome of a test
1056+
case. Exactly one member MUST be set:
1057+
1058+
.. list-table::
1059+
:header-rows: 1
1060+
:widths: 10 30 60
1061+
1062+
* - Property name
1063+
- Type
1064+
- Description
1065+
* - error
1066+
- ``string``
1067+
- A test case expectation resulting in an error. The value is the
1068+
expected error message.
1069+
* - endpoint
1070+
- `EndpointExpectation object`_
1071+
- A test case expectation resulting in a resolved endpoint.
1072+
1073+
1074+
.. _rules-engine-endpoint-test-endpoint-expectation:
1075+
1076+
EndpointExpectation object
1077+
--------------------------
1078+
1079+
The ``EndpointExpectation`` object describes the expected endpoint resolved for
1080+
a test case. It supports the following members:
1081+
1082+
.. list-table::
1083+
:header-rows: 1
1084+
:widths: 10 30 60
1085+
1086+
* - Property name
1087+
- Type
1088+
- Description
1089+
* - url
1090+
- ``string``
1091+
- The expected endpoint URL.
1092+
* - headers
1093+
- ``map<string, [string]>``
1094+
- A map of expected transport header names to their values.
1095+
* - properties
1096+
- ``map<string, document>``
1097+
- The expected properties for the endpoint.
1098+
1099+
9241100
.. _Javadocs: https://smithy.io/javadoc/__smithy_version__/software/amazon/smithy/rulesengine/language/EndpointRuleSetExtension.html
9251101
.. _service providers: https://docs.oracle.com/javase/tutorial/sound/SPI-intro.html

0 commit comments

Comments
 (0)