diff options
Diffstat (limited to 'test/tracetesting/currency')
| -rw-r--r-- | test/tracetesting/currency/all.yaml | 11 | ||||
| -rw-r--r-- | test/tracetesting/currency/convert.yaml | 34 | ||||
| -rw-r--r-- | test/tracetesting/currency/supported.yaml | 25 |
3 files changed, 70 insertions, 0 deletions
diff --git a/test/tracetesting/currency/all.yaml b/test/tracetesting/currency/all.yaml new file mode 100644 index 0000000..2f30f4f --- /dev/null +++ b/test/tracetesting/currency/all.yaml @@ -0,0 +1,11 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: TestSuite +spec: + id: currency-all + name: 'Currency Service' + description: Run all Currency Service tests enabled in sequence + steps: + - ./convert.yaml + - ./supported.yaml diff --git a/test/tracetesting/currency/convert.yaml b/test/tracetesting/currency/convert.yaml new file mode 100644 index 0000000..ddae749 --- /dev/null +++ b/test/tracetesting/currency/convert.yaml @@ -0,0 +1,34 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: Test +spec: + id: currency-convert + name: 'Currency: Convert' + description: Convert a currency + trigger: + type: grpc + grpc: + protobufFile: ../../../pb/demo.proto + address: ${var:CURRENCY_ADDR} + method: oteldemo.CurrencyService.Convert + request: |- + { + "from": { + "currencyCode": "USD", + "units": 330, + "nanos": 750000000 + }, + "toCode": "CAD" + } + specs: + - name: It converts from USD to CAD + selector: span[tracetest.span.type="rpc" name="Currency/Convert" rpc.system="grpc" + rpc.method="Convert" rpc.service="oteldemo.CurrencyService"] + assertions: + - attr:app.currency.conversion.from = "USD" + - attr:app.currency.conversion.to = "CAD" + - name: It has more nanos than expected + selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:tracetest.response.body| json_path '$.nanos' >= 599380800 diff --git a/test/tracetesting/currency/supported.yaml b/test/tracetesting/currency/supported.yaml new file mode 100644 index 0000000..9959e49 --- /dev/null +++ b/test/tracetesting/currency/supported.yaml @@ -0,0 +1,25 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +type: Test +spec: + id: currency-supported + name: 'Currency: Supported' + description: Get all supported currencies + trigger: + type: grpc + grpc: + protobufFile: ../../../pb/demo.proto + address: ${var:CURRENCY_ADDR} + method: oteldemo.CurrencyService.GetSupportedCurrencies + specs: + - name: It has a span called "Currency/GetSupportedCurrencies" + selector: span[tracetest.span.type="rpc" name="Currency/GetSupportedCurrencies" + rpc.system="grpc" rpc.method="GetSupportedCurrencies" rpc.service="oteldemo.CurrencyService"] + assertions: + - attr:name = "Currency/GetSupportedCurrencies" + - name: It returns the expected currency codes + selector: span[tracetest.span.type="general" name="Tracetest trigger"] + assertions: + - attr:tracetest.response.body | json_path '$.currencyCodes[0]' = "ZAR" + - attr:tracetest.response.body | json_path '$.currencyCodes[32]' = "MYR" |
