Skip to content

Add cross-service integration tests for Order → Product → Notification flow#77

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782998407-cross-service-integration-tests
Open

Add cross-service integration tests for Order → Product → Notification flow#77
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782998407-cross-service-integration-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Adds 16 cross-service integration tests exercising the full Order → Product → Notification flow, along with the minimum service implementations needed to support them.

Service implementations (previously scaffold stubs):

  • Product service: ProductEntity, IProductRepository/ProductRepository, full ProductController with POST /api/product and GET /api/product/{id}, EnsureCreated in Program.cs.
  • Order service: OrderEntity, IOrderRepository/OrderRepository, OrderController.Create that:
    1. Validates CustomerId != Guid.Empty and Quantity > 0
    2. Calls GET /api/product/{id} on Product service to validate product existence and fetch price
    3. Computes TotalAmount = product.Price * quantity
    4. Persists the order
    5. Publishes OrderPlacedEvent via POST /api/notification/events/order-placed to Notification service

Bug fix: All 5 service .API.csproj files referenced Shared projects with ..\..\Shared\... (resolves to Services/Shared/ — doesn't exist). Fixed to ..\..\..\Shared\....

Test infrastructure:

  • docker-compose.integration.yml — postgres + rabbitmq + product/order/notification services with health checks
  • DockerComposeFixture (xUnit ICollectionFixture) — starts stack, polls /healthz, tears down with docker compose down -v
  • TestPriorityAttribute + PriorityOrderer for deterministic test ordering

Integration tests (OrderProductNotificationFlowTests):

  1. Create product → verify 201 + correct fields
  2. GET product → verify retrieval
  3. Create product → place order → verify 201, productName, unitPrice, totalAmount computed from product
  4. GET order → verify retrieval
  5. Place order → poll GET /api/notification → verify notification has matching orderId, customerId, orderTotal, rendered subject
  6. Verify notification HTML preview (GET /api/notification/{id}/preview) contains Order Confirmed
  7. Order with non-existent productId → 400 + "does not exist"
  8. Order price/name pulled from actual product data
    9–12. Error scenarios: empty customerId, zero/negative quantity, empty productId → 400
    13–15. GET non-existent order/product/notification → 404
  9. Full E2E: 2 products, 2 orders, 2 distinct notifications with correct totals

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/0b08b35ba5664b54807c3f392a3809c1
Requested by: @bsmitches

…n flow

- Implement Product service CRUD (entity, repository, controller with POST/GET)
- Implement Order service with product validation via HTTP and event publishing
  to Notification service
- Fix csproj Shared reference paths across all 5 services
  (..\..\Shared → ..\..\..\Shared)
- Add docker-compose.integration.yml with health checks for test orchestration
- Add xUnit integration test project (16 tests covering full flow):
  * Product creation and retrieval
  * Order placement with product validation
  * Notification event propagation verification
  * Product existence validation before order acceptance
  * Error scenarios: non-existent product, invalid customer, invalid quantity
  * Full E2E multi-order flow with distinct notifications
- Install curl in service Dockerfiles for health check support
@bsmitches bsmitches self-assigned this Jul 2, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant