Skip to content

Commit

Permalink
[chore] fix trace tests (#1377)
Browse files Browse the repository at this point in the history
* add tracetesting vars

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>

* fix tests targets

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>

* update for semconv

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>

* update actions/checkout version

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>

* update trace based tests

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>

---------

Signed-off-by: Pierre Tessier <pierre@pierretessier.com>
  • Loading branch information
puckpuck authored Feb 14, 2024
1 parent 1b2214e commit 2d16971
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
name: "Run CI"
steps:
- name: check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: install docker
run: |
curl -fsSL https://get.docker.com -o get-docker.sh
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ composer.lock
src/frontend/cypress/videos
src/frontend/cypress/screenshots
src/shippingservice/target/
test/tracetesting/tracetesting-vars.yaml

# Ignore copied/generated protobuf files
/src/cartservice/src/protos/
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ the release.
([#1359](https://github.com/open-telemetry/opentelemetry-demo/pull/1359))
* [productcatalog] allow products to be extended
([#1363](https://github.com/open-telemetry/opentelemetry-demo/pull/1363))
* [tests] update trace based tests for semantic conventions
([#1377](https://github.com/open-telemetry/opentelemetry-demo/pull/1377))

## 1.7.2

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,14 @@ build-env-file:
sed -i '/IMAGE_VERSION=.*/c\IMAGE_VERSION=${RELEASE_VERSION}' .ghcr.env
sed -i '/IMAGE_NAME=.*/c\IMAGE_NAME=${GHCR_REPO}' .ghcr.env

.PHONY: run-tests
run-tests:
docker compose run frontendTests
docker compose run integrationTests
# integrationTests is deprecated in favor of traceBasedTests
# docker compose run integrationTests
docker compose run traceBasedTests

.PHONY: run-tracetesting
run-tracetesting:
docker compose run traceBasedTests ${SERVICES_TO_TEST}

Expand Down
4 changes: 2 additions & 2 deletions test/tracetesting/cart-service/add-item-to-cart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ spec:
}
specs:
- name: It added an item correctly into the shopping cart
selector: span[name="oteldemo.CartService/AddItem"]
selector: span[name="POST /oteldemo.CartService/AddItem"]
assertions:
- attr:rpc.grpc.status_code = 0
- attr:grpc.status_code = 0
- name: It set the cart item correctly on the database
selector: span[tracetest.span.type="database" name="HMSET" db.system="redis" db.redis.database_index="0"]
assertions:
Expand Down
4 changes: 2 additions & 2 deletions test/tracetesting/cart-service/check-if-cart-is-empty.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ spec:
}
specs:
- name: It retrieved the cart items correctly
selector: span[name="oteldemo.CartService/GetCart"]
selector: span[name="POST /oteldemo.CartService/GetCart"]
assertions:
- attr:rpc.grpc.status_code = 0
- attr:grpc.status_code = 0
- name: It returned no items
selector: span[tracetest.span.type="general" name="Tracetest trigger"]
assertions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ spec:
}
specs:
- name: It retrieved the cart items correctly
selector: span[name="oteldemo.CartService/GetCart"]
selector: span[name="POST /oteldemo.CartService/GetCart"]
assertions:
- attr:rpc.grpc.status_code = 0
- attr:grpc.status_code = 0
- name: It returned the first item with correct attributes
selector: span[tracetest.span.type="general" name="Tracetest trigger"]
assertions:
Expand Down
4 changes: 2 additions & 2 deletions test/tracetesting/cart-service/empty-cart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ spec:
}
specs:
- name: It emptied the shopping cart with success
selector: span[name="oteldemo.CartService/EmptyCart"]
selector: span[name="POST /oteldemo.CartService/EmptyCart"]
assertions:
- attr:rpc.grpc.status_code = 0
- attr:grpc.status_code = 0
- name: It sent cleaning message to the database
selector: span[tracetest.span.type="database" name="EXPIRE" db.system="redis" db.redis.database_index="0"]
assertions:
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 @@ -24,7 +24,7 @@ spec:
specs:
- name: It converts from USD to CAD
selector: span[tracetest.span.type="rpc" name="CurrencyService/Convert" rpc.system="grpc"
rpc.method="Convert" rpc.service="CurrencyService"]
rpc.method="Convert" rpc.service="oteldemo.CurrencyService"]
assertions:
- attr:app.currency.conversion.from = "USD"
- attr:app.currency.conversion.to = "CAD"
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 @@ -15,7 +15,7 @@ spec:
specs:
- name: It has a span called "CurrencyService/GetSupportedCurrencies"
selector: span[tracetest.span.type="rpc" name="CurrencyService/GetSupportedCurrencies"
rpc.system="grpc" rpc.method="GetSupportedCurrencies" rpc.service="CurrencyService"]
rpc.system="grpc" rpc.method="GetSupportedCurrencies" rpc.service="oteldemo.CurrencyService"]
assertions:
- attr:name = "CurrencyService/GetSupportedCurrencies"
- name: It returns the expected currency codes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ spec:
assertions:
- attr:tracetest.response.status = 200
- name: It added an item correctly into the shopping cart
selector: span[name="oteldemo.CartService/AddItem"]
selector: span[name="POST /oteldemo.CartService/AddItem"]
assertions:
- attr:rpc.grpc.status_code = 0
- attr:grpc.status_code = 0
- attr:app.product.id = "0PUK6V6EV0"
- name: It set the cart item correctly on the database
selector: span[tracetest.span.type="database" name="HMSET" db.system="redis" db.redis.database_index="0"]
Expand Down
4 changes: 2 additions & 2 deletions test/tracetesting/frontend-service/05-view-cart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ spec:
assertions:
- attr:tracetest.response.status = 200
- name: It retrieved the cart items correctly
selector: span[name="oteldemo.CartService/GetCart"]
selector: span[name="POST /oteldemo.CartService/GetCart"]
assertions:
- attr:rpc.grpc.status_code = 0
- attr:grpc.status_code = 0

0 comments on commit 2d16971

Please sign in to comment.