Skip to content

Commit 4dc9617

Browse files
authored
test: CosmosDB emulator tests (#1713)
* CosmosDB emulator tests * skipping input + move vars to pipeline * move vars to pipeline * fix test directory
1 parent 4b46140 commit 4dc9617

File tree

16 files changed

+121
-104
lines changed

16 files changed

+121
-104
lines changed

eng/templates/jobs/ci-emulator-tests.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ jobs:
7575
eng/scripts/test-setup.sh
7676
displayName: 'Install test python extension, dependencies and the worker'
7777
condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true))
78+
- bash: |
79+
docker pull mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview
80+
docker run --detach --publish 8081:8081 --publish 1234:1234 mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview
81+
docker ps
82+
displayName: "Start CosmosDB Emulator"
7883
- bash: |
7984
docker compose -f workers/tests/emulator_tests/utils/eventhub/docker-compose.yml pull
8085
docker compose -f workers/tests/emulator_tests/utils/eventhub/docker-compose.yml up -d
@@ -83,7 +88,10 @@ jobs:
8388
python -m pytest -q -n auto --dist loadfile --reruns 4 --ignore=tests/emulator_tests/test_servicebus_functions.py tests/emulator_tests
8489
env:
8590
AzureWebJobsStorage: "UseDevelopmentStorage=true"
86-
AzureWebJobsEventHubConnectionString: "Endpoint=sb://localhost;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;"
91+
AzureWebJobsEventHubConnectionString: $(EmulatorEventHubConnectionString)
92+
AzureWebJobsCosmosDBConnectionString: $(EmulatorCosmosDBConnectionString)
93+
CosmosDBEmulatorUrl: $(CosmosDBEmulatorUrl)
94+
CosmosDBEmulatorKey: $(CosmosDBEmulatorKey)
8795
workingDirectory: $(Build.SourcesDirectory)/workers
8896
displayName: "Running $(PYTHON_VERSION) Python Linux Emulator Tests"
8997
- bash: |
@@ -99,6 +107,6 @@ jobs:
99107
python -m pytest -q -n auto --dist loadfile --reruns 4 tests/emulator_tests/test_servicebus_functions.py
100108
env:
101109
AzureWebJobsStorage: "UseDevelopmentStorage=true"
102-
AzureWebJobsServiceBusConnectionString: "Endpoint=sb://localhost;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;"
110+
AzureWebJobsServiceBusConnectionString: $(EmulatorServiceBusConnectionString)
103111
workingDirectory: $(Build.SourcesDirectory)/workers
104112
displayName: "Running $(PYTHON_VERSION) Python ServiceBus Linux Emulator Tests"

workers/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Repository = "https://github.com/Azure/azure-functions-python-worker"
5050

5151
[project.optional-dependencies]
5252
dev = [
53+
"azure-cosmos", # Used for CosmosDB Emulator tests
5354
"azure-eventhub", # Used for EventHub E2E tests
5455
"azure-functions-durable", # Used for Durable E2E tests
5556
"azure-monitor-opentelemetry; python_version >= '3.8'", # Used for Azure Monitor unit tests

0 commit comments

Comments
 (0)