Skip to content

Commit

Permalink
chore: update trace based tests to test stream events (open-telemetry…
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbdias committed Aug 30, 2023
1 parent 8bc972f commit 86fa7f2
Show file tree
Hide file tree
Showing 39 changed files with 77 additions and 50 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ release.

## Unreleased

* update trace-based tests to test stream events
([#1072](https://github.com/open-telemetry/opentelemetry-demo/pull/1072))
* Add cartServiceFailure feature flag triggering Cart Service errors
([#824](https://github.com/open-telemetry/opentelemetry-demo/pull/824))
* [paymentservice] update JS SDKs to 1.12.0/0.38.0
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ services:
- PRODUCT_CATALOG_SERVICE_ADDR
- RECOMMENDATION_SERVICE_ADDR
- SHIPPING_SERVICE_ADDR
- KAFKA_SERVICE_ADDR
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
Expand Down Expand Up @@ -790,6 +791,10 @@ services:
condition: service_started
quoteservice:
condition: service_started
accountingservice:
condition: service_started
frauddetectionservice:
condition: service_started

tracetest-server:
image: kubeshop/tracetest:latest
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/ad-service/all.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

type: Transaction
type: TestSuite
spec:
id: ad-service-all
name: 'Ad Service'
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/ad-service/get.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:AD_SERVICE_ADDR}
address: ${var:AD_SERVICE_ADDR}
method: oteldemo.AdService.GetAds
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/cart-service/add-item-to-cart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:CART_SERVICE_ADDR}
address: ${var:CART_SERVICE_ADDR}
method: oteldemo.CartService.AddItem
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/cart-service/all.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

type: Transaction
type: TestSuite
spec:
id: cart-all
name: 'Cart Service'
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/cart-service/check-if-cart-is-empty.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:CART_SERVICE_ADDR}
address: ${var:CART_SERVICE_ADDR}
method: oteldemo.CartService.GetCart
request: |-
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:CART_SERVICE_ADDR}
address: ${var:CART_SERVICE_ADDR}
method: oteldemo.CartService.GetCart
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/cart-service/empty-cart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:CART_SERVICE_ADDR}
address: ${var:CART_SERVICE_ADDR}
method: oteldemo.CartService.EmptyCart
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/checkout-service/all.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

type: Transaction
type: TestSuite
spec:
id: checkout-service-all
name: 'Checkout Service'
Expand Down
6 changes: 5 additions & 1 deletion test/tracetesting/checkout-service/place-order.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:CHECKOUT_SERVICE_ADDR}
address: ${var:CHECKOUT_SERVICE_ADDR}
method: oteldemo.CheckoutService.PlaceOrder
request: |-
{
Expand Down Expand Up @@ -44,3 +44,7 @@ spec:
rpc.system="grpc" rpc.method="PlaceOrder" rpc.service="oteldemo.CheckoutService"]
assertions:
- attr:rpc.grpc.status_code = 0
- name: It sends an order to be processed asyncronously
selector: span[tracetest.span.type="messaging" name="orders send" messaging.system="kafka" messaging.destination="orders" messaging.destination_kind="topic" messaging.operation="send"]
assertions:
- attr:messaging.destination = "orders"
2 changes: 1 addition & 1 deletion test/tracetesting/currency-service/all.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

type: Transaction
type: TestSuite
spec:
id: currency-service-all
name: 'Currency Service'
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/currency-service/convert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:CURRENCY_SERVICE_ADDR}
address: ${var:CURRENCY_SERVICE_ADDR}
method: oteldemo.CurrencyService.Convert
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/currency-service/supported.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:CURRENCY_SERVICE_ADDR}
address: ${var:CURRENCY_SERVICE_ADDR}
method: oteldemo.CurrencyService.GetSupportedCurrencies
specs:
- name: It has a span called "CurrencyService/GetSupportedCurrencies"
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/email-service/all.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

type: Transaction
type: TestSuite
spec:
id: email-service-all
name: 'Email Service'
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/email-service/confirmation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
trigger:
type: http
httpRequest:
url: ${env:EMAIL_SERVICE_ADDR}/send_order_confirmation
url: ${var:EMAIL_SERVICE_ADDR}/send_order_confirmation
method: POST
headers:
- key: Content-Type
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/frontend-service/01-see-ads.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
trigger:
type: http
httpRequest:
url: http://${env:FRONTEND_ADDR}/api/data
url: http://${var:FRONTEND_ADDR}/api/data
method: GET
headers:
- key: Content-Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
trigger:
type: http
httpRequest:
url: http://${env:FRONTEND_ADDR}/api/recommendations
url: http://${var:FRONTEND_ADDR}/api/recommendations
method: GET
headers:
- key: Content-Type
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/frontend-service/03-browse-product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
trigger:
type: http
httpRequest:
url: http://${env:FRONTEND_ADDR}/api/products/0PUK6V6EV0
url: http://${var:FRONTEND_ADDR}/api/products/0PUK6V6EV0
method: GET
headers:
- key: Content-Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
trigger:
type: http
httpRequest:
url: http://${env:FRONTEND_ADDR}/api/cart
url: http://${var:FRONTEND_ADDR}/api/cart
method: POST
headers:
- key: Content-Type
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/frontend-service/05-view-cart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
trigger:
type: http
httpRequest:
url: http://${env:FRONTEND_ADDR}/api/cart?userId=2491f868-88f1-4345-8836-d5d8511a9f83
url: http://${var:FRONTEND_ADDR}/api/cart?userId=2491f868-88f1-4345-8836-d5d8511a9f83
method: GET
headers:
- key: Content-Type
Expand Down
32 changes: 23 additions & 9 deletions test/tracetesting/frontend-service/06-checking-out-cart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
trigger:
type: http
httpRequest:
url: http://${env:FRONTEND_ADDR}/api/checkout
url: http://${var:FRONTEND_ADDR}/api/checkout
method: POST
headers:
- key: Content-Type
Expand Down Expand Up @@ -38,23 +38,37 @@ spec:
selector: span[tracetest.span.type="general" name="Tracetest trigger"]
assertions:
- attr:tracetest.response.status = 200
- selector: span[tracetest.span.type="rpc" name="oteldemo.CheckoutService/PlaceOrder" rpc.system="grpc" rpc.method="PlaceOrder" rpc.service="oteldemo.CheckoutService"]
name: "The order was placed"
- name: "The order was placed"
selector: span[tracetest.span.type="rpc" name="oteldemo.CheckoutService/PlaceOrder" rpc.system="grpc" rpc.method="PlaceOrder" rpc.service="oteldemo.CheckoutService"]
assertions:
- attr:app.user.id = "2491f868-88f1-4345-8836-d5d8511a9f83"
- attr:app.order.items.count = 1
- selector: span[tracetest.span.type="rpc" name="oteldemo.PaymentService/Charge" rpc.system="grpc" rpc.method="Charge" rpc.service="oteldemo.PaymentService"]
name: "The user was charged"
- name: "The user was charged"
selector: span[tracetest.span.type="rpc" name="oteldemo.PaymentService/Charge" rpc.system="grpc" rpc.method="Charge" rpc.service="oteldemo.PaymentService"]
assertions:
- attr:rpc.grpc.status_code = 0
- attr:tracetest.selected_spans.count >= 1
- selector: span[tracetest.span.type="rpc" name="oteldemo.ShippingService/ShipOrder" rpc.system="grpc" rpc.method="ShipOrder" rpc.service="oteldemo.ShippingService"]
name: "The product was shipped"
- name: "The product was shipped"
selector: span[tracetest.span.type="rpc" name="oteldemo.ShippingService/ShipOrder" rpc.system="grpc" rpc.method="ShipOrder" rpc.service="oteldemo.ShippingService"]
assertions:
- attr:rpc.grpc.status_code = 0
- attr:tracetest.selected_spans.count >= 1
- selector: span[tracetest.span.type="rpc" name="oteldemo.CartService/EmptyCart" rpc.system="grpc" rpc.method="EmptyCart" rpc.service="oteldemo.CartService"]
name: "The cart was emptied"
- name: "The cart was emptied"
selector: span[tracetest.span.type="rpc" name="oteldemo.CartService/EmptyCart" rpc.system="grpc" rpc.method="EmptyCart" rpc.service="oteldemo.CartService"]
assertions:
- attr:rpc.grpc.status_code = 0
- attr:tracetest.selected_spans.count >= 1
- name: The order was sent to be processed asyncronously
selector: span[tracetest.span.type="messaging" name="orders send" messaging.system="kafka" messaging.destination="orders" messaging.destination_kind="topic" messaging.operation="send"]
assertions:
- attr:messaging.destination = "orders"
- name: The order was sent to accountability
# captures the span emitted by Kafka instrumentation for Go
selector: span[tracetest.span.type="messaging" name="orders receive" messaging.system="kafka" messaging.destination="orders" messaging.destination_kind="topic" messaging.operation="receive"]
assertions:
- attr:name = "orders receive"
- name: The order was sent to fraud detection team
# captures the span emitted by Kafka instrumentation for Kotlin
selector: span[tracetest.span.type="messaging" name="orders process" messaging.system="kafka" messaging.operation="process"]
assertions:
- attr:name = "orders process"
2 changes: 1 addition & 1 deletion test/tracetesting/frontend-service/all.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

type: Transaction
type: TestSuite
spec:
id: frontend-all
name: 'Frontend Service'
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/payment-service/all.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

type: Transaction
type: TestSuite
spec:
id: payment-service-all
name: 'Payment Service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:PAYMENT_SERVICE_ADDR}
address: ${var:PAYMENT_SERVICE_ADDR}
method: oteldemo.PaymentService.Charge
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/payment-service/expired-credit-card.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:PAYMENT_SERVICE_ADDR}
address: ${var:PAYMENT_SERVICE_ADDR}
method: oteldemo.PaymentService.Charge
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/payment-service/invalid-credit-card.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:PAYMENT_SERVICE_ADDR}
address: ${var:PAYMENT_SERVICE_ADDR}
method: oteldemo.PaymentService.Charge
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/payment-service/valid-credit-card.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:PAYMENT_SERVICE_ADDR}
address: ${var:PAYMENT_SERVICE_ADDR}
method: oteldemo.PaymentService.Charge
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/product-catalog-service/all.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

type: Transaction
type: TestSuite
spec:
id: product-catalog-service-all
name: 'Product Catalog Service'
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/product-catalog-service/get.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:PRODUCT_CATALOG_SERVICE_ADDR}
address: ${var:PRODUCT_CATALOG_SERVICE_ADDR}
method: oteldemo.ProductCatalogService.GetProduct
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/product-catalog-service/list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:PRODUCT_CATALOG_SERVICE_ADDR}
address: ${var:PRODUCT_CATALOG_SERVICE_ADDR}
method: oteldemo.ProductCatalogService.ListProducts
request: ""
specs:
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/product-catalog-service/search.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:PRODUCT_CATALOG_SERVICE_ADDR}
address: ${var:PRODUCT_CATALOG_SERVICE_ADDR}
method: oteldemo.ProductCatalogService.SearchProducts
request: |-
{
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/recommendation-service/all.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

type: Transaction
type: TestSuite
spec:
id: recommendation-service-all
name: 'Recommendation Service'
Expand Down
2 changes: 1 addition & 1 deletion test/tracetesting/recommendation-service/list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spec:
type: grpc
grpc:
protobufFile: ../../../pb/demo.proto
address: ${env:RECOMMENDATION_SERVICE_ADDR}
address: ${var:RECOMMENDATION_SERVICE_ADDR}
method: oteldemo.RecommendationService.ListRecommendations
request: |-
{
Expand Down
Loading

0 comments on commit 86fa7f2

Please sign in to comment.