An order goes through validation, payment, and shipping. The app runs this logic as a durable orchestration. Unit tests run the same business logic with local steps, without DTS. Money is stored in whole cents.
The Go beta SDK has no public in-memory orchestration backend. The unit tests check business logic only. They do not check replay or DTS behavior. Use the integration test for that.
- Go 1.25 or later. Unit tests need no services.
- For the demo and integration test, the emulator or an Azure task hub. See the shared Go README.
From this directory:
go run .Expected output:
{
"paymentId": "PAY-2000",
"trackingId": "TRACK-ALICE-1",
"totalCents": 2000,
"status": "completed"
}Payment and shipping are simulations.
go test -v .
DTS_SAMPLES_E2E=1 go test -v -run '^TestIntegration$' .Unit tests check step order, results, input rules, and error handling. The integration test runs two valid and three invalid orders through the real orchestration. The failed instances are expected and stay in the dashboard.
Start with processOrder in workflow.go.
| File | Purpose |
|---|---|
| workflow.go | Order data, business logic, and activity calls |
| activities.go | Validation and simulated payment and shipping |
| worker.go | Registers the orchestration and activities |
| client.go | Starts the worker, submits one order, and prints the result |
| main.go | Command-line entry point |
| workflow_test.go | Offline business-logic tests |
| integration_test.go | DTS success and failure tests |