Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] - optimize trace testing #1659

Merged
merged 5 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 5 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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."

Expand Down
128 changes: 128 additions & 0 deletions docker-compose-tests.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions docker-compose-tests_include-override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

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: []
128 changes: 0 additions & 128 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -759,131 +759,3 @@ services:
ports:
- "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
14 changes: 14 additions & 0 deletions test/tracetesting/otelcol-config-tracetest.yml
Original file line number Diff line number Diff line change
@@ -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]
Loading
Loading