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

Add e2e tests to remaining services #242

Merged
merged 12 commits into from
Aug 3, 2022
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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 @@ -45,7 +45,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,3 +41,5 @@ 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))
14 changes: 7 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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 @@ -73,7 +73,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 @@ -93,7 +93,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 @@ -124,7 +124,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 @@ -140,7 +140,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 @@ -207,7 +207,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 @@ -244,7 +244,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
mic-max marked this conversation as resolved.
Show resolved Hide resolved
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