Skip to content

Commit 62d1d9b

Browse files
[tests] - optimize trace testing (#1659)
* optimize trace testing * run trace based tests concurrently * fix lint failures --------- Co-authored-by: Juliano Costa <julianocosta89@outlook.com>
1 parent 14e7f8f commit 62d1d9b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+203
-168
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ the release.
77

88
## Unreleased
99

10+
* [tests] run trace based tests concurrently
11+
([#1659](https://github.com/open-telemetry/opentelemetry-demo/pull/1659))
12+
1013
## 1.11.0
1114

1215
* [accountingservice] convert from Go service to .NET service, uses

Makefile

+5-17
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ build-env-file:
100100

101101
.PHONY: run-tests
102102
run-tests:
103-
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) run frontendTests
104-
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) run traceBasedTests
103+
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run frontendTests
104+
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run traceBasedTests
105105

106106
.PHONY: run-tracetesting
107107
run-tracetesting:
108-
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) run traceBasedTests ${SERVICES_TO_TEST}
108+
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) -f docker-compose-tests.yml run traceBasedTests ${SERVICES_TO_TEST}
109109

110110
.PHONY: generate-protobuf
111111
generate-protobuf:
@@ -147,22 +147,10 @@ start-minimal:
147147
@echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI."
148148
@echo "Go to https://opentelemetry.io/docs/demo/feature-flags/ to learn how to change feature flags."
149149

150-
# Observabilty-Driven Development (ODD)
151-
.PHONY: start-odd
152-
start-odd:
153-
$(DOCKER_COMPOSE_CMD) $(DOCKER_COMPOSE_ENV) --profile odd up --force-recreate --remove-orphans --detach
154-
@echo ""
155-
@echo "OpenTelemetry Demo is running."
156-
@echo "Go to http://localhost:8080 for the demo UI."
157-
@echo "Go to http://localhost:8080/jaeger/ui for the Jaeger UI."
158-
@echo "Go to http://localhost:8080/grafana/ for the Grafana UI."
159-
@echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI."
160-
@echo "Go to http://localhost:11633/ for the Tracetest Web UI."
161-
@echo "Go to https://opentelemetry.io/docs/demo/feature-flags/ to learn how to change feature flags."
162-
163150
.PHONY: stop
164151
stop:
165-
$(DOCKER_COMPOSE_CMD) --profile tests --profile odd down --remove-orphans --volumes
152+
$(DOCKER_COMPOSE_CMD) down --remove-orphans --volumes
153+
$(DOCKER_COMPOSE_CMD) -f docker-compose-tests.yml down --remove-orphans --volumes
166154
@echo ""
167155
@echo "OpenTelemetry Demo is stopped."
168156

docker-compose-tests.yml

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
include:
5+
- path:
6+
- docker-compose.yml # depend on the main docker-compose file
7+
- docker-compose-tests_include-override.yml # include override for tests
8+
9+
services:
10+
# *****
11+
# Tests
12+
# *****
13+
# Frontend Tests
14+
frontendTests:
15+
image: ${IMAGE_NAME}:${DEMO_VERSION}-frontend-tests
16+
container_name: frontend-tests
17+
build:
18+
context: ./
19+
dockerfile: ./src/frontend/Dockerfile.cypress
20+
volumes:
21+
- ./src/frontend/cypress/videos:/app/cypress/videos
22+
- ./src/frontend/cypress/screenshots:/app/cypress/screenshots
23+
environment:
24+
- CYPRESS_baseUrl=http://${FRONTEND_ADDR}
25+
- FRONTEND_ADDR
26+
- NODE_ENV=production
27+
depends_on:
28+
- frontend
29+
30+
# Tracebased Tests
31+
traceBasedTests:
32+
image: ${IMAGE_NAME}:${DEMO_VERSION}-traceBasedTests
33+
container_name: traceBasedTests
34+
build:
35+
context: ./
36+
dockerfile: ./test/tracetesting/Dockerfile
37+
environment:
38+
- AD_SERVICE_ADDR
39+
- CART_SERVICE_ADDR
40+
- CHECKOUT_SERVICE_ADDR
41+
- CURRENCY_SERVICE_ADDR
42+
- EMAIL_SERVICE_ADDR
43+
- FRONTEND_ADDR
44+
- PAYMENT_SERVICE_ADDR
45+
- PRODUCT_CATALOG_SERVICE_ADDR
46+
- RECOMMENDATION_SERVICE_ADDR
47+
- SHIPPING_SERVICE_ADDR
48+
- KAFKA_SERVICE_ADDR
49+
extra_hosts:
50+
- "host.docker.internal:host-gateway"
51+
volumes:
52+
- ./test/tracetesting:/app/test/tracetesting
53+
- ./pb:/app/pb
54+
depends_on:
55+
tracetest-server:
56+
condition: service_healthy
57+
# adding demo services as dependencies
58+
accountingservice:
59+
condition: service_started
60+
adservice:
61+
condition: service_started
62+
cartservice:
63+
condition: service_started
64+
checkoutservice:
65+
condition: service_started
66+
currencyservice:
67+
condition: service_started
68+
emailservice:
69+
condition: service_started
70+
frauddetectionservice:
71+
condition: service_started
72+
frontend:
73+
condition: service_started
74+
paymentservice:
75+
condition: service_started
76+
productcatalogservice:
77+
condition: service_started
78+
quoteservice:
79+
condition: service_started
80+
recommendationservice:
81+
condition: service_started
82+
shippingservice:
83+
condition: service_started
84+
flagd:
85+
condition: service_started
86+
kafka:
87+
condition: service_started
88+
89+
tracetest-server:
90+
image: ${TRACETEST_IMAGE}
91+
platform: linux/amd64
92+
container_name: tracetest-server
93+
volumes:
94+
- type: bind
95+
source: ./test/tracetesting/tracetest-config.yaml
96+
target: /app/tracetest.yaml
97+
- type: bind
98+
source: ./test/tracetesting/tracetest-provision.yaml
99+
target: /app/provision.yaml
100+
command: --provisioning-file /app/provision.yaml
101+
ports:
102+
- 11633:11633
103+
extra_hosts:
104+
- "host.docker.internal:host-gateway"
105+
depends_on:
106+
tracetest-postgres:
107+
condition: service_healthy
108+
otelcol:
109+
condition: service_started
110+
healthcheck:
111+
test: [ "CMD", "wget", "--spider", "localhost:11633" ]
112+
interval: 1s
113+
timeout: 3s
114+
retries: 60
115+
116+
tracetest-postgres:
117+
image: ${POSTGRES_IMAGE}
118+
container_name: tracetest-postgres
119+
environment:
120+
POSTGRES_PASSWORD: postgres
121+
POSTGRES_USER: postgres
122+
healthcheck:
123+
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
124+
interval: 1s
125+
timeout: 5s
126+
retries: 60
127+
ports:
128+
- 5432
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
services:
5+
6+
otelcol:
7+
command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-tracetest.yml" ]
8+
volumes:
9+
- ${DOCKER_SOCK}:/var/run/docker.sock:ro
10+
- ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml
11+
- ./test/tracetesting/otelcol-config-tracetest.yml:/etc/otelcol-config-tracetest.yml
12+
depends_on: []

docker-compose.yml

-128
Original file line numberDiff line numberDiff line change
@@ -759,131 +759,3 @@ services:
759759
ports:
760760
- "9200"
761761
logging: *logging
762-
763-
# *****
764-
# Tests
765-
# *****
766-
# Frontend Tests
767-
frontendTests:
768-
image: ${IMAGE_NAME}:${DEMO_VERSION}-frontend-tests
769-
container_name: frontend-tests
770-
build:
771-
context: ./
772-
dockerfile: ./src/frontend/Dockerfile.cypress
773-
profiles:
774-
- tests
775-
volumes:
776-
- ./src/frontend/cypress/videos:/app/cypress/videos
777-
- ./src/frontend/cypress/screenshots:/app/cypress/screenshots
778-
environment:
779-
- CYPRESS_baseUrl=http://${FRONTEND_ADDR}
780-
- FRONTEND_ADDR
781-
- NODE_ENV=production
782-
depends_on:
783-
- frontend
784-
785-
# Tracebased Tests
786-
traceBasedTests:
787-
image: ${IMAGE_NAME}:${DEMO_VERSION}-traceBasedTests
788-
container_name: traceBasedTests
789-
profiles:
790-
- tests
791-
build:
792-
context: ./
793-
dockerfile: ./test/tracetesting/Dockerfile
794-
environment:
795-
- AD_SERVICE_ADDR
796-
- CART_SERVICE_ADDR
797-
- CHECKOUT_SERVICE_ADDR
798-
- CURRENCY_SERVICE_ADDR
799-
- EMAIL_SERVICE_ADDR
800-
- FRONTEND_ADDR
801-
- PAYMENT_SERVICE_ADDR
802-
- PRODUCT_CATALOG_SERVICE_ADDR
803-
- RECOMMENDATION_SERVICE_ADDR
804-
- SHIPPING_SERVICE_ADDR
805-
- KAFKA_SERVICE_ADDR
806-
extra_hosts:
807-
- "host.docker.internal:host-gateway"
808-
volumes:
809-
- ./test/tracetesting:/app/test/tracetesting
810-
- ./pb:/app/pb
811-
depends_on:
812-
tracetest-server:
813-
condition: service_healthy
814-
# adding demo services as dependencies
815-
frontend:
816-
condition: service_started
817-
adservice:
818-
condition: service_started
819-
cartservice:
820-
condition: service_started
821-
checkoutservice:
822-
condition: service_started
823-
currencyservice:
824-
condition: service_started
825-
emailservice:
826-
condition: service_started
827-
paymentservice:
828-
condition: service_started
829-
productcatalogservice:
830-
condition: service_started
831-
recommendationservice:
832-
condition: service_started
833-
shippingservice:
834-
condition: service_started
835-
quoteservice:
836-
condition: service_started
837-
accountingservice:
838-
condition: service_started
839-
frauddetectionservice:
840-
condition: service_started
841-
flagd:
842-
condition: service_started
843-
844-
tracetest-server:
845-
image: ${TRACETEST_IMAGE}
846-
platform: linux/amd64
847-
container_name: tracetest-server
848-
profiles:
849-
- tests
850-
- odd # Observabilty-Driven Development (ODD)
851-
volumes:
852-
- type: bind
853-
source: ./test/tracetesting/tracetest-config.yaml
854-
target: /app/tracetest.yaml
855-
- type: bind
856-
source: ./test/tracetesting/tracetest-provision.yaml
857-
target: /app/provision.yaml
858-
command: --provisioning-file /app/provision.yaml
859-
ports:
860-
- 11633:11633
861-
extra_hosts:
862-
- "host.docker.internal:host-gateway"
863-
depends_on:
864-
tracetest-postgres:
865-
condition: service_healthy
866-
otelcol:
867-
condition: service_started
868-
healthcheck:
869-
test: [ "CMD", "wget", "--spider", "localhost:11633" ]
870-
interval: 1s
871-
timeout: 3s
872-
retries: 60
873-
874-
tracetest-postgres:
875-
image: ${POSTGRES_IMAGE}
876-
container_name: tracetest-postgres
877-
profiles:
878-
- tests
879-
- odd # Observabilty-Driven Development (ODD)
880-
environment:
881-
POSTGRES_PASSWORD: postgres
882-
POSTGRES_USER: postgres
883-
healthcheck:
884-
test: pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB"
885-
interval: 1s
886-
timeout: 5s
887-
retries: 60
888-
ports:
889-
- 5432
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
exporters:
5+
otlp/tracetest:
6+
endpoint: http://tracetest-server:4317
7+
tls:
8+
insecure: true
9+
10+
service:
11+
pipelines:
12+
traces:
13+
processors: []
14+
exporters: [debug, spanmetrics, otlp/tracetest]

0 commit comments

Comments
 (0)