Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# don't ever lint node_modules
node_modules
# don't lint build output (make sure it's set to your correct build folder name)
build
dist
# don't lint nyc coverage output
coverage
# don't lint proto files and output
proto
# don't ever lint node_modules
node_modules
# don't lint build output (make sure it's set to your correct build folder name)
build
dist
# don't lint nyc coverage output
coverage
# don't lint proto files and output
proto
# don't lint auto-generated version files
**/version.ts
56 changes: 56 additions & 0 deletions .github/workflows/dts-e2e-tests.yaml
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: ["22.x", "24.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
Comment thread Fixed
121 changes: 73 additions & 48 deletions .github/workflows/pr-validation.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,73 @@
name: 🚀 Test and Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

env:
NODE_VER: 22

services:
# docker run --name durabletask-sidecar -p 4001:4001 --env 'DURABLETASK_SIDECAR_LOGLEVEL=Debug' --rm cgillum/durabletask-sidecar:latest start --backend Emulator
durabletask-sidecar:
image: cgillum/durabletask-sidecar:latest
ports:
- 4001:4001
env:
DURABLETASK_SIDECAR_LOGLEVEL: Debug
DURABLETASK_STORAGE_PROVIDER: Emulator

steps:
- name: 📥 Checkout code
uses: actions/checkout@v4

- name: ⚙️ NodeJS - Install
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VER }}
registry-url: "https://registry.npmjs.org"

- name: ⚙️ Install dependencies
run: npm install

- name: 🔨 Build packages
run: npm run build

- name: ✅ Run unit tests
run: npm run test:unit

- name: ✅ Run e2e tests
run: npm run test:e2e
name: 🚀 Test and Build

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
lint-and-unit-tests:
runs-on: ubuntu-latest

env:
NODE_VER: 18.x

steps:
- name: 📥 Checkout code
uses: actions/checkout@v4

- name: ⚙️ NodeJS - Install
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VER }}
registry-url: "https://registry.npmjs.org"

- name: ⚙️ Install dependencies
run: npm install

- name: 🔍 Run linting
run: npm run lint

- name: ✅ Run unit tests
run: npm run test:unit

e2e-tests:
strategy:
fail-fast: false
matrix:
node-version: ["22.x", "24.x"]
needs: lint-and-unit-tests
runs-on: ubuntu-latest

steps:
- name: 📥 Checkout code
uses: actions/checkout@v4

- 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

# Install Go SDK for durabletask-go sidecar
- name: 🔧 Install Go SDK
uses: actions/setup-go@v5
with:
go-version: "stable"

# Install and run the durabletask-go sidecar for running e2e tests
- name: ✅ Run E2E tests with durabletask-go sidecar
run: |
go install github.com/microsoft/durabletask-go@main
durabletask-go --port 4001 &
sleep 5 # Wait for sidecar to be ready
npm run test:e2e:internal
Comment thread Fixed
6 changes: 5 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/tests/**/*.spec.ts"],
testMatch: ["**/tests/**/*.spec.ts", "**/test/**/*.spec.ts"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
moduleNameMapper: {
"^@microsoft/durabletask-js$": "<rootDir>/packages/durabletask-js/src/index.ts",
"^@microsoft/durabletask-js-azuremanaged$": "<rootDir>/packages/durabletask-js-azuremanaged/src/index.ts",
},
transform: {
"^.+\\.tsx?$": [
"ts-jest",
Expand Down
122 changes: 62 additions & 60 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,60 +1,62 @@
{
"name": "durabletask-js-monorepo",
"version": "0.0.0",
"private": true,
"description": "Durable Task JavaScript SDK monorepo",
"workspaces": [
"packages/*"
],
"scripts": {
"build": "npm run build --workspaces",
"build:core": "npm run build -w @microsoft/durabletask-js",
"build:azuremanaged": "npm run build -w @microsoft/durabletask-js-azuremanaged",
"test": "npm run test --workspaces",
"test:unit": "npm run test:unit --workspaces --if-present",
"test:e2e": "./scripts/test-e2e.sh",
"test:e2e:internal": "jest tests/e2e --runInBand --detectOpenHandles",
"test:e2e:one": "jest tests/e2e --runInBand --detectOpenHandles --testNamePattern",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"pretty": "prettier --list-different \"**/*.{ts,tsx,js,jsx,json,md}\"",
"pretty-fix": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
"download-proto": "./scripts/download-proto.sh",
"generate-grpc": "./tools/generate-grpc-javascript.sh ./packages/durabletask-js/src/proto",
"example": "ts-node --swc"
},
"engines": {
"node": ">=22.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/microsoft/durabletask-js.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/microsoft/durabletask-js/issues"
},
"homepage": "https://github.com/microsoft/durabletask-js#readme",
"devDependencies": {
"@swc/core": "^1.3.55",
"@swc/helpers": "^0.5.1",
"@types/jest": "^29.5.1",
"@types/node": "^18.16.1",
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
"dotenv": "^17.2.3",
"eslint": "^8.1.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-prettier": "^4.2.1",
"grpc_tools_node_protoc_ts": "^5.3.3",
"grpc-tools": "^1.13.1",
"husky": "^8.0.1",
"jest": "^29.5.0",
"nodemon": "^3.1.4",
"prettier": "^2.4.0",
"pretty-quick": "^3.1.3",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
}
}
{
"name": "durabletask-js-monorepo",
"version": "0.0.0",
"private": true,
"description": "Durable Task JavaScript SDK monorepo",
"workspaces": [
"packages/*"
],
"scripts": {
"build": "npm run build --workspaces",
"build:core": "npm run build -w @microsoft/durabletask-js",
"build:azuremanaged": "npm run build -w @microsoft/durabletask-js-azuremanaged",
"test": "npm run test --workspaces",
"test:unit": "npm run test:unit --workspaces --if-present",
"test:e2e": "./scripts/test-e2e.sh",
"test:e2e:internal": "jest tests/e2e --runInBand --detectOpenHandles",
"test:e2e:one": "jest tests/e2e --runInBand --detectOpenHandles --testNamePattern",
"test:e2e:azuremanaged:internal": "jest test/e2e-azuremanaged --runInBand --detectOpenHandles",
"test:e2e:azuremanaged": "./scripts/test-e2e-azuremanaged.sh",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"pretty": "prettier --list-different \"**/*.{ts,tsx,js,jsx,json,md}\"",
"pretty-fix": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
"download-proto": "./scripts/download-proto.sh",
"generate-grpc": "./tools/generate-grpc-javascript.sh ./packages/durabletask-js/src/proto",
"example": "ts-node --swc"
},
"engines": {
"node": ">=22.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/microsoft/durabletask-js.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/microsoft/durabletask-js/issues"
},
"homepage": "https://github.com/microsoft/durabletask-js#readme",
"devDependencies": {
"@swc/core": "^1.3.55",
"@swc/helpers": "^0.5.1",
"@types/jest": "^29.5.1",
"@types/node": "^18.16.1",
"@typescript-eslint/eslint-plugin": "^5.1.0",
"@typescript-eslint/parser": "^5.1.0",
"dotenv": "^17.2.3",
"eslint": "^8.1.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-prettier": "^4.2.1",
"grpc_tools_node_protoc_ts": "^5.3.3",
"grpc-tools": "^1.13.1",
"husky": "^8.0.1",
"jest": "^29.5.0",
"nodemon": "^3.1.4",
"prettier": "^2.4.0",
"pretty-quick": "^3.1.3",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
}
}
7 changes: 5 additions & 2 deletions packages/durabletask-js-azuremanaged/src/client-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export class DurableTaskAzureManagedClientBuilder {
build(): TaskHubGrpcClient {
const hostAddress = this._options.getHostAddress();
const channelCredentials = this._options.createChannelCredentials();
const metadataGenerator = this._options.createMetadataGenerator();

const defaultOptions: grpc.ChannelOptions = {
"grpc.primary_user_agent": "durabletask-js-azuremanaged",
Expand All @@ -143,8 +144,10 @@ export class DurableTaskAzureManagedClientBuilder {
...this._grpcChannelOptions,
};

// Use the core TaskHubGrpcClient with custom credentials (no inheritance needed)
return new TaskHubGrpcClient(hostAddress, combinedOptions, true, channelCredentials);
// Use the core TaskHubGrpcClient with custom credentials and metadata generator
// For insecure connections, metadata is passed via the metadataGenerator parameter
// For secure connections, metadata is included in the channel credentials
return new TaskHubGrpcClient(hostAddress, combinedOptions, true, channelCredentials, metadataGenerator);
}
}

Expand Down
Loading
Loading