Skip to content

Commit

Permalink
Add e2e tests to remaining services (open-telemetry#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
mic-max authored Aug 3, 2022
1 parent 26f98f6 commit 1fa7b25
Show file tree
Hide file tree
Showing 10 changed files with 348 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CHECKOUT_SERVICE_ADDR=checkoutservice:${CHECKOUT_SERVICE_PORT}
CURRENCY_SERVICE_PORT=7000
CURRENCY_SERVICE_ADDR=currencyservice:${CURRENCY_SERVICE_PORT}

EMAIL_SERVICE_PORT=8080
EMAIL_SERVICE_PORT=6060
EMAIL_SERVICE_ADDR=http://emailservice:${EMAIL_SERVICE_PORT}

PAYMENT_SERVICE_PORT=50051
Expand All @@ -46,7 +46,7 @@ PRODUCT_CATALOG_SERVICE_ADDR=productcatalogservice:${PRODUCT_CATALOG_SERVICE_POR
RECOMMENDATION_SERVICE_PORT=9001
RECOMMENDATION_SERVICE_ADDR=recommendationservice:${RECOMMENDATION_SERVICE_PORT}

SHIPPING_SERVICE_PORT=50051
SHIPPING_SERVICE_PORT=50050
SHIPPING_SERVICE_ADDR=shippingservice:${SHIPPING_SERVICE_PORT}

FEATURE_FLAG_SERVICE_PORT=50052
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ significant modifications will be credited to OpenTelemetry Authors.
([#189](https://github.com/open-telemetry/opentelemetry-demo/pull/189))
* Simplified repo name and dropped the '-webstore' suffix in every place
([#225](https://github.com/open-telemetry/opentelemetry-demo/pull/225))
* Added end-to-end tests to each individual service
([#242](https://github.com/open-telemetry/opentelemetry-demo/pull/242))
* Added ability for repo forks to specify additional collector settings
([#246](https://github.com/open-telemetry/opentelemetry-demo/pull/246))
* Add metrics endpoint in adservice to send metrics from java agent
Expand Down
14 changes: 7 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ services:
context: ./
dockerfile: ./src/adservice/Dockerfile
ports:
- "${AD_SERVICE_PORT}"
- "${AD_SERVICE_PORT}:${AD_SERVICE_PORT}"
environment:
- AD_SERVICE_PORT
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
Expand All @@ -75,7 +75,7 @@ services:
context: ./
dockerfile: ./src/cartservice/src/Dockerfile
ports:
- "${CART_SERVICE_PORT}"
- "${CART_SERVICE_PORT}:${CART_SERVICE_PORT}"
environment:
- CART_SERVICE_PORT
- REDIS_ADDR
Expand All @@ -95,7 +95,7 @@ services:
context: ./
dockerfile: ./src/checkoutservice/Dockerfile
ports:
- "${CHECKOUT_SERVICE_PORT}"
- "${CHECKOUT_SERVICE_PORT}:${CHECKOUT_SERVICE_PORT}"
environment:
- CHECKOUT_SERVICE_PORT
- CART_SERVICE_ADDR
Expand Down Expand Up @@ -126,7 +126,7 @@ services:
- GRPC_VERSION=1.46.0
- OPENTELEMETRY_VERSION=1.4.0
ports:
- "${CURRENCY_SERVICE_PORT}"
- "${CURRENCY_SERVICE_PORT}:${CURRENCY_SERVICE_PORT}"
environment:
- PORT=${CURRENCY_SERVICE_PORT}
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
Expand All @@ -142,7 +142,7 @@ services:
build:
context: ./src/emailservice
ports:
- "${EMAIL_SERVICE_PORT}"
- "${EMAIL_SERVICE_PORT}:${EMAIL_SERVICE_PORT}"
environment:
- APP_ENV=production
- PORT=${EMAIL_SERVICE_PORT}
Expand Down Expand Up @@ -209,7 +209,7 @@ services:
context: ./
dockerfile: ./src/productcatalogservice/Dockerfile
ports:
- "${PRODUCT_CATALOG_SERVICE_PORT}"
- "${PRODUCT_CATALOG_SERVICE_PORT}:${PRODUCT_CATALOG_SERVICE_PORT}"
environment:
- PRODUCT_CATALOG_SERVICE_PORT
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
Expand Down Expand Up @@ -246,7 +246,7 @@ services:
context: ./
dockerfile: ./src/shippingservice/Dockerfile
ports:
- "${SHIPPING_SERVICE_PORT}"
- "${SHIPPING_SERVICE_PORT}:${SHIPPING_SERVICE_PORT}"
environment:
- PORT=${SHIPPING_SERVICE_PORT}
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
Expand Down
2 changes: 1 addition & 1 deletion src/emailservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ WORKDIR /email_server

COPY . .

EXPOSE 8080
EXPOSE ${EMAIL_SERVICE_PORT}
ENTRYPOINT ["bundle", "exec", "ruby", "email_server.rb"]
4 changes: 2 additions & 2 deletions src/shippingservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN GRPC_HEALTH_PROBE_VERSION=v0.4.7 && \
chmod +x /bin/grpc_health_probe
WORKDIR /app
COPY --from=builder /app/target/release/shippingservice /shippingservice
ENV PORT=50051
ENV PORT=50052

EXPOSE 50051
EXPOSE 50052
ENTRYPOINT ["/shippingservice"]
2 changes: 1 addition & 1 deletion src/shippingservice/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
init_logger()?;
init_tracer()?;
info!("OTel pipeline created");
let port = env::var("PORT").unwrap_or_else(|_| "50051".to_string());
let port = env::var("PORT").unwrap_or_else(|_| "50050".to_string());
let addr = format!("0.0.0.0:{}", port).parse()?;
info!("listening on {}", addr);
let shipper = ShippingServer::default();
Expand Down
83 changes: 83 additions & 0 deletions test/data.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,72 @@
{
"ad": {
"contextKeys": [ "galaxy", "telescope" ]
},
"cart": {
"userId": "1234",
"item": {
"productId": "OLJCESPC7Z",
"quantity": 1
}
},
"checkout": {
"userId": "1997",
"userCurrency": "USD",
"address": {
"streetAddress": "410 Terry Ave. North",
"city": "Seattle",
"state": "Washington",
"country": "United States",
"zipCode": 98109
},
"email": "amazon@example.com",
"creditCard": {
"creditCardNumber": "4117-7059-6121-5486",
"creditCardCvv": 346,
"creditCardExpirationYear": 2025,
"creditCardExpirationMonth": 3
}
},
"currency": {
"from": {
"currencyCode": "USD",
"units": 330,
"nanos": 750000000
},
"toCode": "CAD"
},
"email": {
"email": "google@example.com",
"order": {
"orderId": "505",
"shippingTrackingId": "dead-beef",
"shippingCost": {
"currencyCode": "USD",
"units": 17,
"nanos": 980000000
},
"shippingAddress": {
"streetAddress": "1600 Amphitheatre Parkway",
"city": "Mountain View",
"state": "California",
"country": "United States",
"zipCode": 94043
},
"items": [
{
"item": {
"productId": "1YMWWN1N4O",
"quantity": 5
},
"cost": {
"currencyCode": "USD",
"units": 100,
"nanos": 0
}
}
]
}
},
"charge": {
"amount": {
"currencyCode": "USD",
Expand All @@ -15,5 +83,20 @@
"recommend": {
"userId": "1234",
"productIds": [ "OLJCESPC7Z", "66VCHSJNUP", "1YMWWN1N4O", "L9ECAV7KIM", "2ZYFJ3GM2N" ]
},
"shipping": {
"address": {
"streetAddress": "One Microsoft Way",
"city": "Redmond",
"state": "Washington",
"country": "United States",
"zipCode": 98052
},
"items": [
{
"productId": "66VCHSJNUP",
"quantity": 2
}
]
}
}
68 changes: 67 additions & 1 deletion test/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"@grpc/grpc-js": "1.6.7",
"dotenv": "16.0.1"
"dotenv": "16.0.1",
"node-fetch": "2.6.7"
}
}
Loading

0 comments on commit 1fa7b25

Please sign in to comment.