-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a user purchasing product trace-based test case
- Loading branch information
1 parent
846ae2d
commit fc1005a
Showing
8 changed files
with
194 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/tracetesting/business-tests/01-add-product-to-cart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
type: Test | ||
spec: | ||
id: add-product | ||
name: Add product to the cart | ||
description: Add a selected product to user shopping cart | ||
trigger: | ||
type: http | ||
httpRequest: | ||
url: ${env:CART_API_URL} | ||
method: POST | ||
headers: | ||
- key: Content-Type | ||
value: application/json | ||
body: '{"item":{"productId":"${env:PRODUCT_ID}","quantity":1},"userId":"${env:USER_ID}"}' | ||
specs: | ||
- name: "The product was persisted correctly on the shopping cart" | ||
selector: span[name="oteldemo.CartService/AddItem"] | ||
assertions: | ||
- attr:app.product.id = "${env:PRODUCT_ID}" |
35 changes: 35 additions & 0 deletions
35
test/tracetesting/business-tests/02-checking-out-cart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
type: Test | ||
spec: | ||
id: checkout-shopping-cart | ||
name: Checking out shopping cart | ||
description: Checking out shopping cart | ||
trigger: | ||
type: http | ||
httpRequest: | ||
url: ${env:CHECKOUT_API_URL} | ||
method: POST | ||
headers: | ||
- key: Content-Type | ||
value: application/json | ||
body: '{"userId":"${env:USER_ID}","email":"someone@example.com","address":{"streetAddress":"1600 Amphitheatre Parkway","state":"CA","country":"United States","city":"Mountain View","zipCode":"94043"},"userCurrency":"USD","creditCard":{"creditCardCvv":672,"creditCardExpirationMonth":1,"creditCardExpirationYear":2030,"creditCardNumber":"4432-8015-6152-0454"}}' | ||
specs: | ||
- 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" | ||
assertions: | ||
- attr:app.user.id = "${env:USER_ID}" | ||
- 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" | ||
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" | ||
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" | ||
assertions: | ||
- attr:rpc.grpc.status_code = 0 | ||
- attr:tracetest.selected_spans.count >= 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CART_API_URL: http://frontend:8080/api/cart | ||
CHECKOUT_API_URL: http://frontend:8080/api/checkout | ||
PRODUCT_ID: OLJCESPC7Z | ||
USER_ID: 2491f868-88f1-4345-8836-d5d8511a9f83 |
8 changes: 8 additions & 0 deletions
8
test/tracetesting/business-tests/user-purchasing-product.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
type: Transaction | ||
spec: | ||
id: user-purchase-product | ||
name: User purchasing products | ||
description: Simulate a process of a user purchasing products on Astronomy store | ||
steps: | ||
- ./01-add-product-to-cart.yaml | ||
- ./02-checking-out-cart.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
scheme: http | ||
endpoint: localhost:11633 | ||
analyticsEnabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
postgres: | ||
host: tracetest-postgres | ||
user: postgres | ||
password: postgres | ||
port: 5432 | ||
dbname: postgres | ||
params: sslmode=disable | ||
|
||
telemetry: | ||
exporters: | ||
collector: | ||
serviceName: tracetest | ||
sampling: 100 # 100% | ||
exporter: | ||
type: collector | ||
collector: | ||
endpoint: otelcol:4317 | ||
|
||
server: | ||
telemetry: | ||
exporter: collector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
type: PollingProfile | ||
spec: | ||
name: Default | ||
strategy: periodic | ||
default: true | ||
periodic: | ||
retryDelay: 5s | ||
timeout: 10m | ||
|
||
--- | ||
type: Demo | ||
spec: | ||
name: "OpenTelemetry Shop" | ||
enabled: true | ||
type: otelstore | ||
opentelemetryStore: | ||
frontendEndpoint: http://frontend:8080 | ||
|
||
--- | ||
type: DataStore | ||
spec: | ||
name: Jaeger | ||
type: jaeger | ||
jaeger: | ||
endpoint: jaeger:16685 | ||
tls: | ||
insecure: true |