diff options
| author | Saumit <justsaumit@protonmail.com> | 2025-09-27 02:14:26 +0530 |
|---|---|---|
| committer | Saumit <justsaumit@protonmail.com> | 2025-09-27 02:14:26 +0530 |
| commit | 82e03978b89938219958032efb1448cc76baa181 (patch) | |
| tree | 626f3e54d52ecd49be0ed3bee30abacc0453d081 /test/tracetesting/shipping | |
Initial snapshot - OpenTelemetry demo 2.1.3 -f
Diffstat (limited to 'test/tracetesting/shipping')
| -rw-r--r-- | test/tracetesting/shipping/all.yaml | 12 | ||||
| -rw-r--r-- | test/tracetesting/shipping/empty-quote.yaml | 36 | ||||
| -rw-r--r-- | test/tracetesting/shipping/order.yaml | 39 | ||||
| -rw-r--r-- | test/tracetesting/shipping/quote.yaml | 40 |
4 files changed, 127 insertions, 0 deletions
diff --git a/test/tracetesting/shipping/all.yaml b/test/tracetesting/shipping/all.yaml new file mode 100644 index 0000000..b41610d --- /dev/null +++ b/test/tracetesting/shipping/all.yaml @@ -0,0 +1,12 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: TestSuite +spec: + id: shipping-all + name: 'Shipping Service' + description: Run all Shipping Service tests enabled in sequence + steps: + - ./quote.yaml + - ./empty-quote.yaml + - ./order.yaml diff --git a/test/tracetesting/shipping/empty-quote.yaml b/test/tracetesting/shipping/empty-quote.yaml new file mode 100644 index 0000000..ae422d1 --- /dev/null +++ b/test/tracetesting/shipping/empty-quote.yaml @@ -0,0 +1,36 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: Test +spec: + id: shipping-empty-quote + name: 'Shipping: Empty Quote' + description: Quote delivery for no items + trigger: + type: grpc + grpc: + protobufFile: ../../../pb/demo.proto + address: ${var:SHIPPING_ADDR} + method: oteldemo.ShippingService.GetQuote + request: |- + { + "address": { + "streetAddress": "One Microsoft Way", + "city": "Redmond", + "state": "Washington", + "country": "United States", + "zipCode": "98052" + }, + "items": [] + } + specs: + - name: It called GetQuote correctly + selector: span[tracetest.span.type="rpc" name="oteldemo.ShippingService/GetQuote" rpc.system="grpc"] + assertions: + - attr:rpc.grpc.status_code = 0 + - name: It returned a valid quote + selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:tracetest.response.body | json_path '$.costUsd.currencyCode' = "USD" + - attr:tracetest.response.body | json_path '$.costUsd.units' = 0 + - attr:tracetest.response.body | json_path '$.costUsd.nanos' = 0 diff --git a/test/tracetesting/shipping/order.yaml b/test/tracetesting/shipping/order.yaml new file mode 100644 index 0000000..8c18f1e --- /dev/null +++ b/test/tracetesting/shipping/order.yaml @@ -0,0 +1,39 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: Test +spec: + id: shipping-order + name: 'Shipping: Order' + description: Create one delivery order + trigger: + type: grpc + grpc: + protobufFile: ../../../pb/demo.proto + address: ${var:SHIPPING_ADDR} + method: oteldemo.ShippingService.ShipOrder + request: |- + { + "address": { + "streetAddress": "One Microsoft Way", + "city": "Redmond", + "state": "Washington", + "country": "United States", + "zipCode": "98052" + }, + "items": [ + { + "productId": "66VCHSJNUP", + "quantity": 2 + } + ] + } + specs: + - name: It called GetQuote correctly + selector: span[tracetest.span.type="rpc" name="oteldemo.ShippingService/ShipOrder" rpc.system="grpc"] + assertions: + - attr:rpc.grpc.status_code = 0 + - name: It returned a trackingId + selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:tracetest.response.body | json_path '$.trackingId' != "" diff --git a/test/tracetesting/shipping/quote.yaml b/test/tracetesting/shipping/quote.yaml new file mode 100644 index 0000000..c263fa8 --- /dev/null +++ b/test/tracetesting/shipping/quote.yaml @@ -0,0 +1,40 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: Test +spec: + id: shipping-quote + name: 'Shipping: Quote' + description: Quote delivery for one order + trigger: + type: grpc + grpc: + protobufFile: ../../../pb/demo.proto + address: ${var:SHIPPING_ADDR} + method: oteldemo.ShippingService.GetQuote + request: |- + { + "address": { + "streetAddress": "One Microsoft Way", + "city": "Redmond", + "state": "Washington", + "country": "United States", + "zipCode": "98052" + }, + "items": [ + { + "productId": "66VCHSJNUP", + "quantity": 2 + } + ] + } + specs: + - name: It called GetQuote correctly + selector: span[tracetest.span.type="rpc" name="oteldemo.ShippingService/GetQuote" rpc.system="grpc"] + assertions: + - attr:rpc.grpc.status_code = 0 + - name: It returned a valid quote + selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:tracetest.response.body | json_path '$.costUsd.currencyCode' = "USD" + - attr:tracetest.response.body | json_path '$.costUsd.units' > 0 |
