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/product-catalog | |
Initial snapshot - OpenTelemetry demo 2.1.3 -f
Diffstat (limited to 'test/tracetesting/product-catalog')
| -rw-r--r-- | test/tracetesting/product-catalog/all.yaml | 12 | ||||
| -rw-r--r-- | test/tracetesting/product-catalog/get.yaml | 32 | ||||
| -rw-r--r-- | test/tracetesting/product-catalog/list.yaml | 26 | ||||
| -rw-r--r-- | test/tracetesting/product-catalog/search.yaml | 28 |
4 files changed, 98 insertions, 0 deletions
diff --git a/test/tracetesting/product-catalog/all.yaml b/test/tracetesting/product-catalog/all.yaml new file mode 100644 index 0000000..21f7a12 --- /dev/null +++ b/test/tracetesting/product-catalog/all.yaml @@ -0,0 +1,12 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: TestSuite +spec: + id: product-catalog-all + name: 'Product Catalog' + description: Run all Product Catalog tests enabled in sequence + steps: + - ./list.yaml + - ./get.yaml + - ./search.yaml diff --git a/test/tracetesting/product-catalog/get.yaml b/test/tracetesting/product-catalog/get.yaml new file mode 100644 index 0000000..a1e26c4 --- /dev/null +++ b/test/tracetesting/product-catalog/get.yaml @@ -0,0 +1,32 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: Test +spec: + id: product-get + name: 'Product: Get' + description: Get a single product available on product catalog + trigger: + type: grpc + grpc: + protobufFile: ../../../pb/demo.proto + address: ${var:PRODUCT_CATALOG_ADDR} + method: oteldemo.ProductCatalogService.GetProduct + request: |- + { + "id": "OLJCESPC7Z" + } + specs: + - name: It queried the product catalog correctly for a specific product + selector: span[tracetest.span.type="rpc" name="oteldemo.ProductCatalogService/GetProduct" rpc.system="grpc" rpc.method="GetProduct" rpc.service="oteldemo.ProductCatalogService"] + assertions: + - attr:rpc.grpc.status_code = 0 + - attr:app.product.id = "OLJCESPC7Z" + - name: It returned a product with valid attributes + selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:tracetest.response.body | json_path '$.id' = "OLJCESPC7Z" + - attr:tracetest.response.body | json_path '$.description' != "" + - attr:tracetest.response.body | json_path '$.picture' != "" + - attr:tracetest.response.body | json_path '$.priceUsd' != "{}" + - attr:tracetest.response.body | json_path '$.categories' != "[]" diff --git a/test/tracetesting/product-catalog/list.yaml b/test/tracetesting/product-catalog/list.yaml new file mode 100644 index 0000000..92adadb --- /dev/null +++ b/test/tracetesting/product-catalog/list.yaml @@ -0,0 +1,26 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: Test +spec: + id: product-list + name: 'Product: List' + description: List all products available on product catalog + trigger: + type: grpc + grpc: + protobufFile: ../../../pb/demo.proto + address: ${var:PRODUCT_CATALOG_ADDR} + method: oteldemo.ProductCatalogService.ListProducts + request: "" + specs: + - name: It queried the product catalog correctly + selector: span[tracetest.span.type="rpc" name="oteldemo.ProductCatalogService/ListProducts" + rpc.system="grpc" rpc.method="ListProducts" rpc.service="oteldemo.ProductCatalogService"] + assertions: + - attr:rpc.grpc.status_code = 0 + - attr:app.products.count = 10 + - name: It returned products with IDs + selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:tracetest.response.body | json_path '$.products[*].id' != "" diff --git a/test/tracetesting/product-catalog/search.yaml b/test/tracetesting/product-catalog/search.yaml new file mode 100644 index 0000000..fe211b8 --- /dev/null +++ b/test/tracetesting/product-catalog/search.yaml @@ -0,0 +1,28 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: Test +spec: + id: product-search + name: 'Product: Search' + description: Search for products querying for their names + trigger: + type: grpc + grpc: + protobufFile: ../../../pb/demo.proto + address: ${var:PRODUCT_CATALOG_ADDR} + method: oteldemo.ProductCatalogService.SearchProducts + request: |- + { + "query": "Roof Binoculars" + } + specs: + - name: It called SearchProducts correctly and it returned 1 item + selector: span[tracetest.span.type="rpc" name="oteldemo.ProductCatalogService/SearchProducts" rpc.system="grpc" rpc.method="SearchProducts" rpc.service="oteldemo.ProductCatalogService"] + assertions: + - attr:app.products_search.count = 1 + - attr:rpc.grpc.status_code = 0 + - name: It returned the desired product + selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:tracetest.response.body | json_path '$.results[0].name' = "Roof Binoculars" |
