From ae44e05ec02ff4976657c15436a7e54d78986f95 Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Thu, 4 Jul 2024 08:46:18 -0400 Subject: [PATCH 1/3] optimize trace testing --- Makefile | 22 +-- docker-compose-tests.yml | 128 ++++++++++++++++++ docker-compose-tests_include-override.yml | 9 ++ docker-compose.yml | 127 ----------------- .../{ad-service => adservice}/all.yaml | 0 .../{ad-service => adservice}/get.yaml | 0 .../add-item-to-cart.yaml | 0 .../{cart-service => cartservice}/all.yaml | 0 .../check-if-cart-is-empty.yaml | 0 .../check-if-cart-is-populated.yaml | 0 .../empty-cart.yaml | 0 .../all.yaml | 0 .../place-order.yaml | 0 .../all.yaml | 0 .../convert.yaml | 0 .../supported.yaml | 0 .../{email-service => emailservice}/all.yaml | 0 .../confirmation.yaml | 0 .../01-see-ads.yaml | 0 .../02-get-product-recommendation.yaml | 0 .../03-browse-product.yaml | 0 .../04-add-product-to-cart.yaml | 0 .../05-view-cart.yaml | 0 .../06-checking-out-cart.yaml | 0 .../{frontend-service => frontend}/all.yaml | 0 .../tracetesting/otelcol-config-tracetest.yml | 14 ++ .../all.yaml | 0 .../amex-credit-card-not-allowed.yaml | 0 .../expired-credit-card.yaml | 0 .../invalid-credit-card.yaml | 0 .../valid-credit-card.yaml | 0 .../all.yaml | 0 .../get.yaml | 0 .../list.yaml | 0 .../search.yaml | 0 .../all.yaml | 0 .../list.yaml | 0 test/tracetesting/run.bash | 52 ++++--- .../all.yaml | 0 .../empty-quote.yaml | 0 .../order.yaml | 0 .../quote.yaml | 0 test/tracetesting/tracetest-provision.yaml | 12 +- 43 files changed, 197 insertions(+), 167 deletions(-) create mode 100644 docker-compose-tests.yml create mode 100644 docker-compose-tests_include-override.yml rename test/tracetesting/{ad-service => adservice}/all.yaml (100%) rename test/tracetesting/{ad-service => adservice}/get.yaml (100%) rename test/tracetesting/{cart-service => cartservice}/add-item-to-cart.yaml (100%) rename test/tracetesting/{cart-service => cartservice}/all.yaml (100%) rename test/tracetesting/{cart-service => cartservice}/check-if-cart-is-empty.yaml (100%) rename test/tracetesting/{cart-service => cartservice}/check-if-cart-is-populated.yaml (100%) rename test/tracetesting/{cart-service => cartservice}/empty-cart.yaml (100%) rename test/tracetesting/{checkout-service => checkoutservice}/all.yaml (100%) rename test/tracetesting/{checkout-service => checkoutservice}/place-order.yaml (100%) rename test/tracetesting/{currency-service => currencyservice}/all.yaml (100%) rename test/tracetesting/{currency-service => currencyservice}/convert.yaml (100%) rename test/tracetesting/{currency-service => currencyservice}/supported.yaml (100%) rename test/tracetesting/{email-service => emailservice}/all.yaml (100%) rename test/tracetesting/{email-service => emailservice}/confirmation.yaml (100%) rename test/tracetesting/{frontend-service => frontend}/01-see-ads.yaml (100%) rename test/tracetesting/{frontend-service => frontend}/02-get-product-recommendation.yaml (100%) rename test/tracetesting/{frontend-service => frontend}/03-browse-product.yaml (100%) rename test/tracetesting/{frontend-service => frontend}/04-add-product-to-cart.yaml (100%) rename test/tracetesting/{frontend-service => frontend}/05-view-cart.yaml (100%) rename test/tracetesting/{frontend-service => frontend}/06-checking-out-cart.yaml (100%) rename test/tracetesting/{frontend-service => frontend}/all.yaml (100%) create mode 100644 test/tracetesting/otelcol-config-tracetest.yml rename test/tracetesting/{payment-service => paymentservice}/all.yaml (100%) rename test/tracetesting/{payment-service => paymentservice}/amex-credit-card-not-allowed.yaml (100%) rename test/tracetesting/{payment-service => paymentservice}/expired-credit-card.yaml (100%) rename test/tracetesting/{payment-service => paymentservice}/invalid-credit-card.yaml (100%) rename test/tracetesting/{payment-service => paymentservice}/valid-credit-card.yaml (100%) rename test/tracetesting/{product-catalog-service => productcatalogservice}/all.yaml (100%) rename test/tracetesting/{product-catalog-service => productcatalogservice}/get.yaml (100%) rename test/tracetesting/{product-catalog-service => productcatalogservice}/list.yaml (100%) rename test/tracetesting/{product-catalog-service => productcatalogservice}/search.yaml (100%) rename test/tracetesting/{recommendation-service => recommendationservice}/all.yaml (100%) rename test/tracetesting/{recommendation-service => recommendationservice}/list.yaml (100%) rename test/tracetesting/{shipping-service => shippingservice}/all.yaml (100%) rename test/tracetesting/{shipping-service => shippingservice}/empty-quote.yaml (100%) rename test/tracetesting/{shipping-service => shippingservice}/order.yaml (100%) rename test/tracetesting/{shipping-service => shippingservice}/quote.yaml (100%) diff --git a/Makefile b/Makefile index 4316d60e43..654aad68ed 100644 --- a/Makefile +++ b/Makefile @@ -100,12 +100,12 @@ build-env-file: .PHONY: run-tests run-tests: - $(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) run frontendTests - $(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) run traceBasedTests + $(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run frontendTests + $(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run traceBasedTests .PHONY: run-tracetesting run-tracetesting: - $(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) run traceBasedTests ${SERVICES_TO_TEST} + $(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run traceBasedTests ${SERVICES_TO_TEST} .PHONY: generate-protobuf generate-protobuf: @@ -147,22 +147,10 @@ start-minimal: @echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI." @echo "Go to https://opentelemetry.io/docs/demo/feature-flags/ to learn how to change feature flags." -# Observabilty-Driven Development (ODD) -.PHONY: start-odd -start-odd: - $(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) --profile odd up --force-recreate --remove-orphans --detach - @echo "" - @echo "OpenTelemetry Demo is running." - @echo "Go to http://localhost:8080 for the demo UI." - @echo "Go to http://localhost:8080/jaeger/ui for the Jaeger UI." - @echo "Go to http://localhost:8080/grafana/ for the Grafana UI." - @echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI." - @echo "Go to http://localhost:11633/ for the Tracetest Web UI." - @echo "Go to https://opentelemetry.io/docs/demo/feature-flags/ to learn how to change feature flags." - .PHONY: stop stop: - $(DOCKER_COMPOSE_CMD) --profile tests --profile odd down --remove-orphans --volumes + $(DOCKER_COMPOSE_CMD) down --remove-orphans --volumes + $(DOCKER_COMPOSE_CMD) -f docker-compose-tests.yml down --remove-orphans --volumes @echo "" @echo "OpenTelemetry Demo is stopped." diff --git a/docker-compose-tests.yml b/docker-compose-tests.yml new file mode 100644 index 0000000000..7614d6abc1 --- /dev/null +++ b/docker-compose-tests.yml @@ -0,0 +1,128 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +include: + - path : + - docker-compose.yml # depend on the main docker-compose file + - docker-compose-tests_include-override.yml # include override for tests + +services: + # ***** + # Tests + # ***** + # Frontend Tests + frontendTests: + image: ${IMAGE_NAME}:${DEMO_VERSION}-frontend-tests + container_name: frontend-tests + build: + context: ./ + dockerfile: ./src/frontend/Dockerfile.cypress + volumes: + - ./src/frontend/cypress/videos:/app/cypress/videos + - ./src/frontend/cypress/screenshots:/app/cypress/screenshots + environment: + - CYPRESS_baseUrl=http://${FRONTEND_ADDR} + - FRONTEND_ADDR + - NODE_ENV=production + depends_on: + - frontend + + # Tracebased Tests + traceBasedTests: + image: ${IMAGE_NAME}:${DEMO_VERSION}-traceBasedTests + container_name: traceBasedTests + build: + context: ./ + dockerfile: ./test/tracetesting/Dockerfile + environment: + - AD_SERVICE_ADDR + - CART_SERVICE_ADDR + - CHECKOUT_SERVICE_ADDR + - CURRENCY_SERVICE_ADDR + - EMAIL_SERVICE_ADDR + - FRONTEND_ADDR + - PAYMENT_SERVICE_ADDR + - PRODUCT_CATALOG_SERVICE_ADDR + - RECOMMENDATION_SERVICE_ADDR + - SHIPPING_SERVICE_ADDR + - KAFKA_SERVICE_ADDR + extra_hosts: + - "host.docker.internal:host-gateway" + volumes: + - ./test/tracetesting:/app/test/tracetesting + - ./pb:/app/pb + depends_on: + tracetest-server: + condition: service_healthy + # adding demo services as dependencies + accountingservice: + condition: service_started + adservice: + condition: service_started + cartservice: + condition: service_started + checkoutservice: + condition: service_started + currencyservice: + condition: service_started + emailservice: + condition: service_started + frauddetectionservice: + condition: service_started + frontend: + condition: service_started + paymentservice: + condition: service_started + productcatalogservice: + condition: service_started + quoteservice: + condition: service_started + recommendationservice: + condition: service_started + shippingservice: + condition: service_started + flagd: + condition: service_started + kafka: + condition: service_started + + tracetest-server: + image: ${TRACETEST_IMAGE} + platform: linux/amd64 + container_name: tracetest-server + volumes: + - type: bind + source: ./test/tracetesting/tracetest-config.yaml + target: /app/tracetest.yaml + - type: bind + source: ./test/tracetesting/tracetest-provision.yaml + target: /app/provision.yaml + command: --provisioning-file /app/provision.yaml + ports: + - 11633:11633 + extra_hosts: + - "host.docker.internal:host-gateway" + depends_on: + tracetest-postgres: + condition: service_healthy + otelcol: + condition: service_started + healthcheck: + test: [ "CMD", "wget", "--spider", "localhost:11633" ] + interval: 1s + timeout: 3s + retries: 60 + + tracetest-postgres: + image: ${POSTGRES_IMAGE} + container_name: tracetest-postgres + environment: + POSTGRES_PASSWORD: postgres + POSTGRES_USER: postgres + healthcheck: + test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" + interval: 1s + timeout: 5s + retries: 60 + ports: + - 5432 diff --git a/docker-compose-tests_include-override.yml b/docker-compose-tests_include-override.yml new file mode 100644 index 0000000000..eb37285dfc --- /dev/null +++ b/docker-compose-tests_include-override.yml @@ -0,0 +1,9 @@ +services: + + otelcol: + command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-tracetest.yml" ] + volumes: + - ${DOCKER_SOCK}:/var/run/docker.sock:ro + - ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml + - ./test/tracetesting/otelcol-config-tracetest.yml:/etc/otelcol-config-tracetest.yml + depends_on: [] diff --git a/docker-compose.yml b/docker-compose.yml index 1f54b8d960..15c8e9b588 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -760,130 +760,3 @@ services: - "9200" logging: *logging - # ***** - # Tests - # ***** - # Frontend Tests - frontendTests: - image: ${IMAGE_NAME}:${DEMO_VERSION}-frontend-tests - container_name: frontend-tests - build: - context: ./ - dockerfile: ./src/frontend/Dockerfile.cypress - profiles: - - tests - volumes: - - ./src/frontend/cypress/videos:/app/cypress/videos - - ./src/frontend/cypress/screenshots:/app/cypress/screenshots - environment: - - CYPRESS_baseUrl=http://${FRONTEND_ADDR} - - FRONTEND_ADDR - - NODE_ENV=production - depends_on: - - frontend - - # Tracebased Tests - traceBasedTests: - image: ${IMAGE_NAME}:${DEMO_VERSION}-traceBasedTests - container_name: traceBasedTests - profiles: - - tests - build: - context: ./ - dockerfile: ./test/tracetesting/Dockerfile - environment: - - AD_SERVICE_ADDR - - CART_SERVICE_ADDR - - CHECKOUT_SERVICE_ADDR - - CURRENCY_SERVICE_ADDR - - EMAIL_SERVICE_ADDR - - FRONTEND_ADDR - - PAYMENT_SERVICE_ADDR - - PRODUCT_CATALOG_SERVICE_ADDR - - RECOMMENDATION_SERVICE_ADDR - - SHIPPING_SERVICE_ADDR - - KAFKA_SERVICE_ADDR - extra_hosts: - - "host.docker.internal:host-gateway" - volumes: - - ./test/tracetesting:/app/test/tracetesting - - ./pb:/app/pb - depends_on: - tracetest-server: - condition: service_healthy - # adding demo services as dependencies - frontend: - condition: service_started - adservice: - condition: service_started - cartservice: - condition: service_started - checkoutservice: - condition: service_started - currencyservice: - condition: service_started - emailservice: - condition: service_started - paymentservice: - condition: service_started - productcatalogservice: - condition: service_started - recommendationservice: - condition: service_started - shippingservice: - condition: service_started - quoteservice: - condition: service_started - accountingservice: - condition: service_started - frauddetectionservice: - condition: service_started - flagd: - condition: service_started - - tracetest-server: - image: ${TRACETEST_IMAGE} - platform: linux/amd64 - container_name: tracetest-server - profiles: - - tests - - odd # Observabilty-Driven Development (ODD) - volumes: - - type: bind - source: ./test/tracetesting/tracetest-config.yaml - target: /app/tracetest.yaml - - type: bind - source: ./test/tracetesting/tracetest-provision.yaml - target: /app/provision.yaml - command: --provisioning-file /app/provision.yaml - ports: - - 11633:11633 - extra_hosts: - - "host.docker.internal:host-gateway" - depends_on: - tracetest-postgres: - condition: service_healthy - otelcol: - condition: service_started - healthcheck: - test: [ "CMD", "wget", "--spider", "localhost:11633" ] - interval: 1s - timeout: 3s - retries: 60 - - tracetest-postgres: - image: ${POSTGRES_IMAGE} - container_name: tracetest-postgres - profiles: - - tests - - odd # Observabilty-Driven Development (ODD) - environment: - POSTGRES_PASSWORD: postgres - POSTGRES_USER: postgres - healthcheck: - test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" - interval: 1s - timeout: 5s - retries: 60 - ports: - - 5432 diff --git a/test/tracetesting/ad-service/all.yaml b/test/tracetesting/adservice/all.yaml similarity index 100% rename from test/tracetesting/ad-service/all.yaml rename to test/tracetesting/adservice/all.yaml diff --git a/test/tracetesting/ad-service/get.yaml b/test/tracetesting/adservice/get.yaml similarity index 100% rename from test/tracetesting/ad-service/get.yaml rename to test/tracetesting/adservice/get.yaml diff --git a/test/tracetesting/cart-service/add-item-to-cart.yaml b/test/tracetesting/cartservice/add-item-to-cart.yaml similarity index 100% rename from test/tracetesting/cart-service/add-item-to-cart.yaml rename to test/tracetesting/cartservice/add-item-to-cart.yaml diff --git a/test/tracetesting/cart-service/all.yaml b/test/tracetesting/cartservice/all.yaml similarity index 100% rename from test/tracetesting/cart-service/all.yaml rename to test/tracetesting/cartservice/all.yaml diff --git a/test/tracetesting/cart-service/check-if-cart-is-empty.yaml b/test/tracetesting/cartservice/check-if-cart-is-empty.yaml similarity index 100% rename from test/tracetesting/cart-service/check-if-cart-is-empty.yaml rename to test/tracetesting/cartservice/check-if-cart-is-empty.yaml diff --git a/test/tracetesting/cart-service/check-if-cart-is-populated.yaml b/test/tracetesting/cartservice/check-if-cart-is-populated.yaml similarity index 100% rename from test/tracetesting/cart-service/check-if-cart-is-populated.yaml rename to test/tracetesting/cartservice/check-if-cart-is-populated.yaml diff --git a/test/tracetesting/cart-service/empty-cart.yaml b/test/tracetesting/cartservice/empty-cart.yaml similarity index 100% rename from test/tracetesting/cart-service/empty-cart.yaml rename to test/tracetesting/cartservice/empty-cart.yaml diff --git a/test/tracetesting/checkout-service/all.yaml b/test/tracetesting/checkoutservice/all.yaml similarity index 100% rename from test/tracetesting/checkout-service/all.yaml rename to test/tracetesting/checkoutservice/all.yaml diff --git a/test/tracetesting/checkout-service/place-order.yaml b/test/tracetesting/checkoutservice/place-order.yaml similarity index 100% rename from test/tracetesting/checkout-service/place-order.yaml rename to test/tracetesting/checkoutservice/place-order.yaml diff --git a/test/tracetesting/currency-service/all.yaml b/test/tracetesting/currencyservice/all.yaml similarity index 100% rename from test/tracetesting/currency-service/all.yaml rename to test/tracetesting/currencyservice/all.yaml diff --git a/test/tracetesting/currency-service/convert.yaml b/test/tracetesting/currencyservice/convert.yaml similarity index 100% rename from test/tracetesting/currency-service/convert.yaml rename to test/tracetesting/currencyservice/convert.yaml diff --git a/test/tracetesting/currency-service/supported.yaml b/test/tracetesting/currencyservice/supported.yaml similarity index 100% rename from test/tracetesting/currency-service/supported.yaml rename to test/tracetesting/currencyservice/supported.yaml diff --git a/test/tracetesting/email-service/all.yaml b/test/tracetesting/emailservice/all.yaml similarity index 100% rename from test/tracetesting/email-service/all.yaml rename to test/tracetesting/emailservice/all.yaml diff --git a/test/tracetesting/email-service/confirmation.yaml b/test/tracetesting/emailservice/confirmation.yaml similarity index 100% rename from test/tracetesting/email-service/confirmation.yaml rename to test/tracetesting/emailservice/confirmation.yaml diff --git a/test/tracetesting/frontend-service/01-see-ads.yaml b/test/tracetesting/frontend/01-see-ads.yaml similarity index 100% rename from test/tracetesting/frontend-service/01-see-ads.yaml rename to test/tracetesting/frontend/01-see-ads.yaml diff --git a/test/tracetesting/frontend-service/02-get-product-recommendation.yaml b/test/tracetesting/frontend/02-get-product-recommendation.yaml similarity index 100% rename from test/tracetesting/frontend-service/02-get-product-recommendation.yaml rename to test/tracetesting/frontend/02-get-product-recommendation.yaml diff --git a/test/tracetesting/frontend-service/03-browse-product.yaml b/test/tracetesting/frontend/03-browse-product.yaml similarity index 100% rename from test/tracetesting/frontend-service/03-browse-product.yaml rename to test/tracetesting/frontend/03-browse-product.yaml diff --git a/test/tracetesting/frontend-service/04-add-product-to-cart.yaml b/test/tracetesting/frontend/04-add-product-to-cart.yaml similarity index 100% rename from test/tracetesting/frontend-service/04-add-product-to-cart.yaml rename to test/tracetesting/frontend/04-add-product-to-cart.yaml diff --git a/test/tracetesting/frontend-service/05-view-cart.yaml b/test/tracetesting/frontend/05-view-cart.yaml similarity index 100% rename from test/tracetesting/frontend-service/05-view-cart.yaml rename to test/tracetesting/frontend/05-view-cart.yaml diff --git a/test/tracetesting/frontend-service/06-checking-out-cart.yaml b/test/tracetesting/frontend/06-checking-out-cart.yaml similarity index 100% rename from test/tracetesting/frontend-service/06-checking-out-cart.yaml rename to test/tracetesting/frontend/06-checking-out-cart.yaml diff --git a/test/tracetesting/frontend-service/all.yaml b/test/tracetesting/frontend/all.yaml similarity index 100% rename from test/tracetesting/frontend-service/all.yaml rename to test/tracetesting/frontend/all.yaml diff --git a/test/tracetesting/otelcol-config-tracetest.yml b/test/tracetesting/otelcol-config-tracetest.yml new file mode 100644 index 0000000000..5ce06ce150 --- /dev/null +++ b/test/tracetesting/otelcol-config-tracetest.yml @@ -0,0 +1,14 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +exporters: + otlp/tracetest: + endpoint: http://tracetest-server:4317 + tls: + insecure: true + +service: + pipelines: + traces: + processors: [] + exporters: [debug, spanmetrics, otlp/tracetest] diff --git a/test/tracetesting/payment-service/all.yaml b/test/tracetesting/paymentservice/all.yaml similarity index 100% rename from test/tracetesting/payment-service/all.yaml rename to test/tracetesting/paymentservice/all.yaml diff --git a/test/tracetesting/payment-service/amex-credit-card-not-allowed.yaml b/test/tracetesting/paymentservice/amex-credit-card-not-allowed.yaml similarity index 100% rename from test/tracetesting/payment-service/amex-credit-card-not-allowed.yaml rename to test/tracetesting/paymentservice/amex-credit-card-not-allowed.yaml diff --git a/test/tracetesting/payment-service/expired-credit-card.yaml b/test/tracetesting/paymentservice/expired-credit-card.yaml similarity index 100% rename from test/tracetesting/payment-service/expired-credit-card.yaml rename to test/tracetesting/paymentservice/expired-credit-card.yaml diff --git a/test/tracetesting/payment-service/invalid-credit-card.yaml b/test/tracetesting/paymentservice/invalid-credit-card.yaml similarity index 100% rename from test/tracetesting/payment-service/invalid-credit-card.yaml rename to test/tracetesting/paymentservice/invalid-credit-card.yaml diff --git a/test/tracetesting/payment-service/valid-credit-card.yaml b/test/tracetesting/paymentservice/valid-credit-card.yaml similarity index 100% rename from test/tracetesting/payment-service/valid-credit-card.yaml rename to test/tracetesting/paymentservice/valid-credit-card.yaml diff --git a/test/tracetesting/product-catalog-service/all.yaml b/test/tracetesting/productcatalogservice/all.yaml similarity index 100% rename from test/tracetesting/product-catalog-service/all.yaml rename to test/tracetesting/productcatalogservice/all.yaml diff --git a/test/tracetesting/product-catalog-service/get.yaml b/test/tracetesting/productcatalogservice/get.yaml similarity index 100% rename from test/tracetesting/product-catalog-service/get.yaml rename to test/tracetesting/productcatalogservice/get.yaml diff --git a/test/tracetesting/product-catalog-service/list.yaml b/test/tracetesting/productcatalogservice/list.yaml similarity index 100% rename from test/tracetesting/product-catalog-service/list.yaml rename to test/tracetesting/productcatalogservice/list.yaml diff --git a/test/tracetesting/product-catalog-service/search.yaml b/test/tracetesting/productcatalogservice/search.yaml similarity index 100% rename from test/tracetesting/product-catalog-service/search.yaml rename to test/tracetesting/productcatalogservice/search.yaml diff --git a/test/tracetesting/recommendation-service/all.yaml b/test/tracetesting/recommendationservice/all.yaml similarity index 100% rename from test/tracetesting/recommendation-service/all.yaml rename to test/tracetesting/recommendationservice/all.yaml diff --git a/test/tracetesting/recommendation-service/list.yaml b/test/tracetesting/recommendationservice/list.yaml similarity index 100% rename from test/tracetesting/recommendation-service/list.yaml rename to test/tracetesting/recommendationservice/list.yaml diff --git a/test/tracetesting/run.bash b/test/tracetesting/run.bash index 7c2b4a0314..966a04572b 100755 --- a/test/tracetesting/run.bash +++ b/test/tracetesting/run.bash @@ -7,6 +7,18 @@ set -e +# Availalble services to test +ALL_SERVICES=("adservice" "cartservice" "currencyservice" "checkoutservice" "frontend" "emailservice" "paymentservice" "productcatalogservice" "recommendationservice" "shippingservice") + +## Script variables +# Will contain the list of services to test +chosen_services=() +# Array to hold process IDs +pids=() +# Array to hold exit codes +exit_codes=() + +## Script functions check_if_tracetest_is_installed() { if ! command -v tracetest &> /dev/null then @@ -51,21 +63,19 @@ run_tracetest() { service_name=$1 testsuite_file=./$service_name/all.yaml - tracetest --config ./cli-config.yml run testsuite --file $testsuite_file --vars ./tracetesting-vars.yaml - return $? + tracetest --config ./cli-config.yml run testsuite --file $testsuite_file --vars ./tracetesting-vars.yaml & + pids+=($!) } -ALL_SERVICES=("ad-service" "cart-service" "currency-service" "checkout-service" "frontend-service" "email-service" "payment-service" "product-catalog-service" "recommendation-service" "shipping-service") -CHOSEN_SERVICES=() - +## Script execution while [[ $# -gt 0 ]]; do - CHOSEN_SERVICES+=("$1") + chosen_services+=("$1") shift done -if [ ${#CHOSEN_SERVICES[@]} -eq 0 ]; then +if [ ${#chosen_services[@]} -eq 0 ]; then for service in "${ALL_SERVICES[@]}"; do - CHOSEN_SERVICES+=("$service") + chosen_services+=("$service") done fi @@ -73,18 +83,28 @@ check_if_tracetest_is_installed create_env_file echo "Starting tests..." +echo "Running trace-based tests for: ${chosen_services[*]} ..." +echo "" -EXIT_STATUS=0 +for service in "${chosen_services[@]}"; do + run_tracetest $service +done -echo "" -echo "Running trace-based tests..." -echo "" +# Wait for processes to finish and capture their exit codes +for pid in "${pids[@]}"; do + wait $pid + exit_codes+=($?) +done -for service in "${CHOSEN_SERVICES[@]}"; do - run_tracetest $service || EXIT_STATUS=$? +# Find the maximum exit code +max_exit_code=0 +for code in "${exit_codes[@]}"; do + if [[ $code -gt $max_exit_code ]]; then + max_exit_code=$code + fi done echo "" -echo "Tests done! Exit code: $EXIT_STATUS" +echo "Tests done! Exit code: $max_exit_code" -exit $EXIT_STATUS \ No newline at end of file +exit $max_exit_code diff --git a/test/tracetesting/shipping-service/all.yaml b/test/tracetesting/shippingservice/all.yaml similarity index 100% rename from test/tracetesting/shipping-service/all.yaml rename to test/tracetesting/shippingservice/all.yaml diff --git a/test/tracetesting/shipping-service/empty-quote.yaml b/test/tracetesting/shippingservice/empty-quote.yaml similarity index 100% rename from test/tracetesting/shipping-service/empty-quote.yaml rename to test/tracetesting/shippingservice/empty-quote.yaml diff --git a/test/tracetesting/shipping-service/order.yaml b/test/tracetesting/shippingservice/order.yaml similarity index 100% rename from test/tracetesting/shipping-service/order.yaml rename to test/tracetesting/shippingservice/order.yaml diff --git a/test/tracetesting/shipping-service/quote.yaml b/test/tracetesting/shippingservice/quote.yaml similarity index 100% rename from test/tracetesting/shipping-service/quote.yaml rename to test/tracetesting/shippingservice/quote.yaml diff --git a/test/tracetesting/tracetest-provision.yaml b/test/tracetesting/tracetest-provision.yaml index 27f4ff8b95..a37cc40602 100644 --- a/test/tracetesting/tracetest-provision.yaml +++ b/test/tracetesting/tracetest-provision.yaml @@ -8,7 +8,7 @@ spec: strategy: periodic default: true periodic: - retryDelay: 10s + retryDelay: 5s timeout: 3m --- @@ -23,12 +23,10 @@ spec: --- type: DataStore spec: - name: Jaeger - type: jaeger - jaeger: - endpoint: jaeger:16685 - tls: - insecure: true + name: Opentelemetry Collector pipeline + type: otlp + default: true + --- type: TestRunner spec: From f6ccc701a8e0e4c74212827f6899786699db6461 Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Thu, 4 Jul 2024 08:58:23 -0400 Subject: [PATCH 2/3] run trace based tests concurrently --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cfc180f36..591d16d361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ the release. ## Unreleased +* [tests] run trace based tests concurrently + ([#1659](https://github.com/open-telemetry/opentelemetry-demo/pull/1659)) + ## 1.11.0 * [accountingservice] convert from Go service to .NET service, uses From ca71d7aa2ed6db557019eabb0ae450f5fd741078 Mon Sep 17 00:00:00 2001 From: Pierre Tessier Date: Thu, 4 Jul 2024 09:18:46 -0400 Subject: [PATCH 3/3] fix lint failures --- docker-compose-tests.yml | 2 +- docker-compose-tests_include-override.yml | 3 +++ docker-compose.yml | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docker-compose-tests.yml b/docker-compose-tests.yml index 7614d6abc1..1c97ceb6ac 100644 --- a/docker-compose-tests.yml +++ b/docker-compose-tests.yml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 include: - - path : + - path: - docker-compose.yml # depend on the main docker-compose file - docker-compose-tests_include-override.yml # include override for tests diff --git a/docker-compose-tests_include-override.yml b/docker-compose-tests_include-override.yml index eb37285dfc..3fea4d60cc 100644 --- a/docker-compose-tests_include-override.yml +++ b/docker-compose-tests_include-override.yml @@ -1,3 +1,6 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + services: otelcol: diff --git a/docker-compose.yml b/docker-compose.yml index 15c8e9b588..fba9299ee4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -759,4 +759,3 @@ services: ports: - "9200" logging: *logging -