From a418de014d0fdcfaef6043b1b38e063abd109404 Mon Sep 17 00:00:00 2001 From: Pierre Tessier <pierre@pierretessier.com> Date: Tue, 13 Feb 2024 21:48:06 -0500 Subject: [PATCH 1/5] add tracetesting vars Signed-off-by: Pierre Tessier <pierre@pierretessier.com> --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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/ From 0d1d2823ec4e1995dcf5ef9402132c5ebb43b920 Mon Sep 17 00:00:00 2001 From: Pierre Tessier <pierre@pierretessier.com> Date: Tue, 13 Feb 2024 21:48:30 -0500 Subject: [PATCH 2/5] fix tests targets Signed-off-by: Pierre Tessier <pierre@pierretessier.com> --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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} From c714a5ae5ec2cda912e5f449af7c73a0fc665b2d Mon Sep 17 00:00:00 2001 From: Pierre Tessier <pierre@pierretessier.com> Date: Tue, 13 Feb 2024 21:48:52 -0500 Subject: [PATCH 3/5] update for semconv Signed-off-by: Pierre Tessier <pierre@pierretessier.com> --- test/tracetesting/cart-service/add-item-to-cart.yaml | 4 ++-- test/tracetesting/cart-service/check-if-cart-is-empty.yaml | 4 ++-- .../tracetesting/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 +- .../tracetesting/frontend-service/04-add-product-to-cart.yaml | 4 ++-- test/tracetesting/frontend-service/05-view-cart.yaml | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) 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 From a6d78dd8b3b4b0deac62697ab4533e691a37769c Mon Sep 17 00:00:00 2001 From: Pierre Tessier <pierre@pierretessier.com> Date: Tue, 13 Feb 2024 21:49:12 -0500 Subject: [PATCH 4/5] update actions/checkout version Signed-off-by: Pierre Tessier <pierre@pierretessier.com> --- .github/workflows/run-integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 8c75851f0f8725d1807e283926bc2b27ef8d9504 Mon Sep 17 00:00:00 2001 From: Pierre Tessier <pierre@pierretessier.com> Date: Tue, 13 Feb 2024 21:54:17 -0500 Subject: [PATCH 5/5] update trace based tests Signed-off-by: Pierre Tessier <pierre@pierretessier.com> --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) 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