From 2d169710c5908f90d089d9cf52b9dc9b80db4aa8 Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Wed, 14 Feb 2024 04:12:27 -0500 Subject: [PATCH] [chore] fix trace tests (#1377) * add tracetesting vars Signed-off-by: Pierre Tessier * fix tests targets Signed-off-by: Pierre Tessier * update for semconv Signed-off-by: Pierre Tessier * update actions/checkout version Signed-off-by: Pierre Tessier * update trace based tests Signed-off-by: Pierre Tessier --------- Signed-off-by: Pierre Tessier --- .github/workflows/run-integration-tests.yml | 2 +- .gitignore | 1 + CHANGELOG.md | 2 ++ Makefile | 5 ++++- test/tracetesting/cart-service/add-item-to-cart.yaml | 4 ++-- test/tracetesting/cart-service/check-if-cart-is-empty.yaml | 4 ++-- .../cart-service/check-if-cart-is-populated.yaml | 4 ++-- test/tracetesting/cart-service/empty-cart.yaml | 4 ++-- test/tracetesting/currency-service/convert.yaml | 2 +- test/tracetesting/currency-service/supported.yaml | 2 +- .../frontend-service/04-add-product-to-cart.yaml | 4 ++-- test/tracetesting/frontend-service/05-view-cart.yaml | 4 ++-- 12 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 3a321a05f2..2bdd95db40 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -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 diff --git a/.gitignore b/.gitignore index 6bf28278f3..f03cd5b132 100644 --- a/.gitignore +++ b/.gitignore @@ -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/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 173f7221a3..b36f98a2df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Makefile b/Makefile index 13c2766417..26c579e5da 100644 --- a/Makefile +++ b/Makefile @@ -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} diff --git a/test/tracetesting/cart-service/add-item-to-cart.yaml b/test/tracetesting/cart-service/add-item-to-cart.yaml index 704ad57708..61af56c9f6 100644 --- a/test/tracetesting/cart-service/add-item-to-cart.yaml +++ b/test/tracetesting/cart-service/add-item-to-cart.yaml @@ -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: diff --git a/test/tracetesting/cart-service/check-if-cart-is-empty.yaml b/test/tracetesting/cart-service/check-if-cart-is-empty.yaml index a78bb784c2..bb3977b084 100644 --- a/test/tracetesting/cart-service/check-if-cart-is-empty.yaml +++ b/test/tracetesting/cart-service/check-if-cart-is-empty.yaml @@ -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: diff --git a/test/tracetesting/cart-service/check-if-cart-is-populated.yaml b/test/tracetesting/cart-service/check-if-cart-is-populated.yaml index b18acc4905..3e1fad6790 100644 --- a/test/tracetesting/cart-service/check-if-cart-is-populated.yaml +++ b/test/tracetesting/cart-service/check-if-cart-is-populated.yaml @@ -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: diff --git a/test/tracetesting/cart-service/empty-cart.yaml b/test/tracetesting/cart-service/empty-cart.yaml index ae8f7a28e3..ddf4d63208 100644 --- a/test/tracetesting/cart-service/empty-cart.yaml +++ b/test/tracetesting/cart-service/empty-cart.yaml @@ -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: diff --git a/test/tracetesting/currency-service/convert.yaml b/test/tracetesting/currency-service/convert.yaml index 9bc7710ce9..4a4c9756d7 100644 --- a/test/tracetesting/currency-service/convert.yaml +++ b/test/tracetesting/currency-service/convert.yaml @@ -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" diff --git a/test/tracetesting/currency-service/supported.yaml b/test/tracetesting/currency-service/supported.yaml index 5533594c80..4bea9ed24b 100644 --- a/test/tracetesting/currency-service/supported.yaml +++ b/test/tracetesting/currency-service/supported.yaml @@ -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 diff --git a/test/tracetesting/frontend-service/04-add-product-to-cart.yaml b/test/tracetesting/frontend-service/04-add-product-to-cart.yaml index f0ad829cb4..3f70cc6774 100644 --- a/test/tracetesting/frontend-service/04-add-product-to-cart.yaml +++ b/test/tracetesting/frontend-service/04-add-product-to-cart.yaml @@ -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"] diff --git a/test/tracetesting/frontend-service/05-view-cart.yaml b/test/tracetesting/frontend-service/05-view-cart.yaml index 921b6e55d0..68f8f06985 100644 --- a/test/tracetesting/frontend-service/05-view-cart.yaml +++ b/test/tracetesting/frontend-service/05-view-cart.yaml @@ -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