-
Notifications
You must be signed in to change notification settings - Fork 10
Set up E2E testing infrastructure aligned with durabletask-python #74
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
base: main
Are you sure you want to change the base?
Changes from all commits
207f2bd
88fd49a
d7f7371
1eba3ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: 🧪 DTS Emulator E2E Tests | ||
|
|
||
| # This workflow runs E2E tests against the Durable Task Scheduler (DTS) emulator. | ||
| # It mirrors the Python testing setup at durabletask-python for Azure-managed tests. | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| dts-e2e-tests: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| node-version: ["18.x", "20.x", "22.x"] | ||
| env: | ||
| EMULATOR_VERSION: "latest" | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: 📥 Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: 🐳 Pull Docker image | ||
| run: docker pull mcr.microsoft.com/dts/dts-emulator:$EMULATOR_VERSION | ||
|
|
||
| - name: 🚀 Run Docker container | ||
| run: | | ||
| docker run --name dtsemulator -d -p 8080:8080 mcr.microsoft.com/dts/dts-emulator:$EMULATOR_VERSION | ||
|
|
||
| - name: ⏳ Wait for container to be ready | ||
| run: sleep 10 # Adjust if your service needs more time to start | ||
|
|
||
| - name: 🔧 Set environment variables | ||
| run: | | ||
| echo "TASKHUB=default" >> $GITHUB_ENV | ||
| echo "ENDPOINT=localhost:8080" >> $GITHUB_ENV | ||
|
|
||
| - name: ⚙️ NodeJS - Install | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ matrix.node-version }} | ||
| registry-url: "https://registry.npmjs.org" | ||
|
|
||
| - name: ⚙️ Install dependencies | ||
| run: npm install | ||
|
|
||
| - name: ✅ Run E2E tests against DTS emulator | ||
| run: npm run test:e2e:azuremanaged:internal | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| #!/bin/bash | ||
| # Script to run E2E tests against the DTS (Durable Task Scheduler) emulator. | ||
| # | ||
| # This script mirrors the Python testing setup at durabletask-python for Azure-managed tests. | ||
| # It expects the DTS emulator to be running at the specified endpoint. | ||
| # | ||
| # Environment variables: | ||
| # - ENDPOINT: The endpoint for the DTS emulator (default: localhost:8080) | ||
| # - TASKHUB: The task hub name (default: default) | ||
|
|
||
| ENDPOINT="${ENDPOINT:-localhost:8080}" | ||
| TASKHUB="${TASKHUB:-default}" | ||
|
|
||
| # Start the DTS emulator if it is not running yet | ||
| if [ ! "$(docker ps -q -f name=dts-emulator)" ]; then | ||
| if [ "$(docker ps -aq -f status=exited -f name=dts-emulator)" ]; then | ||
| # cleanup | ||
| docker rm dts-emulator | ||
| fi | ||
|
|
||
| # run your container | ||
| echo "Starting DTS emulator" | ||
| docker run \ | ||
| --name dts-emulator -d --rm \ | ||
|
||
| -p 8080:8080 \ | ||
| mcr.microsoft.com/dts/dts-emulator:latest | ||
|
|
||
| # Wait for container to be ready | ||
| echo "Waiting for DTS emulator to be ready..." | ||
| sleep 10 | ||
| fi | ||
|
|
||
| echo "Running E2E tests against DTS emulator" | ||
| echo "Endpoint: $ENDPOINT" | ||
| echo "TaskHub: $TASKHUB" | ||
|
|
||
| ENDPOINT="$ENDPOINT" TASKHUB="$TASKHUB" npm run test:e2e:azuremanaged:internal | ||
|
|
||
| # It should fail if the npm run fails | ||
| if [ $? -ne 0 ]; then | ||
| echo "E2E tests failed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Stopping DTS emulator" | ||
| docker stop dts-emulator | ||
Uh oh!
There was an error while loading. Please reload this page.