Skip to content

Commit ed26bd0

Browse files
hallvictoriaVictoria HallYunchuWang
authored
test: run supported tests with emulators (#1564)
* run emulators for blob tests * blob, table, queue working. large refactor * directory changes * fix: public build, generic table creation, eh config * docker-compose * emulator support * skip eventhub metadata tests for 37 * run db blob tests in emulator * db blob tests dir change * fix db test directory * merge * run emulator tests for 312 * remove git repo clone * refactor docker-compose, codeowners * retries for flaky tests * update codeowners * run emulator tests on schedule, lowercase config * merge miss * move servicebus tests to emulators * parameter miss * formatting * merge miss * lint * feedback * container name --------- Co-authored-by: Victoria Hall <[email protected]> Co-authored-by: wangbill <[email protected]>
1 parent d7a735a commit ed26bd0

File tree

159 files changed

+1365
-962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+1365
-962
lines changed

CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
# For all file changes, github would automatically
1111
# include the following people in the PRs.
1212

13-
* @vrdmr @gavin-aguiar @YunchuWang @pdthummar @hallvictoria
13+
* @vrdmr @gavin-aguiar @hallvictoria

eng/ci/emulator-tests.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
trigger: none # ensure this is not ran as a CI build
2+
3+
pr:
4+
branches:
5+
include:
6+
- dev
7+
- release/*
8+
9+
schedules:
10+
- cron: "0 8 * * 1,2,3,4,5"
11+
displayName: Monday to Friday 3 AM CST build
12+
branches:
13+
include:
14+
- dev
15+
always: true
16+
17+
resources:
18+
repositories:
19+
- repository: 1es
20+
type: git
21+
name: 1ESPipelineTemplates/1ESPipelineTemplates
22+
ref: refs/tags/release
23+
- repository: eng
24+
type: git
25+
name: engineering
26+
ref: refs/tags/release
27+
28+
variables:
29+
- template: /ci/variables/build.yml@eng
30+
- template: /ci/variables/cfs.yml@eng
31+
- template: /eng/templates/utils/variables.yml@self
32+
33+
extends:
34+
template: v1/1ES.Unofficial.PipelineTemplate.yml@1es
35+
parameters:
36+
pool:
37+
name: 1es-pool-azfunc
38+
image: 1es-windows-2022
39+
os: windows
40+
41+
stages:
42+
- stage: RunEmulatorTests
43+
jobs:
44+
- template: /eng/templates/jobs/ci-emulator-tests.yml@self
45+
parameters:
46+
PoolName: 1es-pool-azfunc

eng/ci/official-build.yml

+6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ extends:
5454
dependsOn: Build
5555
jobs:
5656
- template: /eng/templates/official/jobs/ci-e2e-tests.yml@self
57+
- stage: RunEmulatorTests
58+
dependsOn: Build
59+
jobs:
60+
- template: /eng/templates/jobs/ci-emulator-tests.yml@self
61+
parameters:
62+
PoolName: 1es-pool-azfunc
5763
- stage: RunUnitTests
5864
dependsOn: Build
5965
jobs:

eng/ci/public-build.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,10 @@ extends:
5353
- stage: RunUnitTests
5454
dependsOn: Build
5555
jobs:
56-
- template: /eng/templates/jobs/ci-unit-tests.yml@self
56+
- template: /eng/templates/jobs/ci-unit-tests.yml@self
57+
- stage: RunEmulatorTests
58+
dependsOn: Build
59+
jobs:
60+
- template: /eng/templates/jobs/ci-emulator-tests.yml@self
61+
parameters:
62+
PoolName: 1es-pool-azfunc-public
+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
jobs:
2+
- job: "TestPython"
3+
displayName: "Run Python Emulator Tests"
4+
5+
pool:
6+
name: ${{ parameters.PoolName }}
7+
image: 1es-ubuntu-22.04
8+
os: linux
9+
10+
strategy:
11+
matrix:
12+
Python37:
13+
PYTHON_VERSION: '3.7'
14+
Python38:
15+
PYTHON_VERSION: '3.8'
16+
Python39:
17+
PYTHON_VERSION: '3.9'
18+
Python310:
19+
PYTHON_VERSION: '3.10'
20+
Python311:
21+
PYTHON_VERSION: '3.11'
22+
Python312:
23+
PYTHON_VERSION: '3.12'
24+
steps:
25+
- task: UsePythonVersion@0
26+
inputs:
27+
versionSpec: $(PYTHON_VERSION)
28+
- task: UseDotNet@2
29+
displayName: 'Install .NET 8'
30+
inputs:
31+
version: 8.0.x
32+
- bash: |
33+
chmod +x eng/scripts/install-dependencies.sh
34+
chmod +x eng/scripts/test-setup.sh
35+
36+
eng/scripts/install-dependencies.sh $(PYTHON_VERSION)
37+
eng/scripts/test-setup.sh
38+
displayName: 'Install dependencies and the worker'
39+
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
40+
- task: DownloadPipelineArtifact@2
41+
displayName: 'Download Python SDK Artifact'
42+
inputs:
43+
buildType: specific
44+
artifactName: 'azure-functions'
45+
project: 'internal'
46+
definition: 679
47+
buildVersionToDownload: latest
48+
targetPath: '$(Pipeline.Workspace)/PythonSdkArtifact'
49+
condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true))
50+
- bash: |
51+
chmod +x eng/scripts/test-sdk.sh
52+
chmod +x eng/scripts/test-setup.sh
53+
54+
eng/scripts/test-sdk.sh $(Pipeline.Workspace) $(PYTHON_VERSION)
55+
eng/scripts/test-setup.sh
56+
displayName: 'Install test python sdk, dependencies and the worker'
57+
condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true))
58+
- task: DownloadPipelineArtifact@2
59+
displayName: 'Download Python Extension Artifact'
60+
inputs:
61+
buildType: specific
62+
artifactName: $(PYTHONEXTENSIONNAME)
63+
project: 'internal'
64+
definition: 798
65+
buildVersionToDownload: latest
66+
targetPath: '$(Pipeline.Workspace)/PythonExtensionArtifact'
67+
condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true))
68+
- bash: |
69+
chmod +x eng/scripts/test-setup.sh
70+
chmod +x eng/scripts/test-extensions.sh
71+
72+
eng/scripts/test-extensions.sh $(Pipeline.Workspace) $(PYTHON_VERSION)
73+
eng/scripts/test-setup.sh
74+
displayName: 'Install test python extension, dependencies and the worker'
75+
condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true))
76+
- bash: |
77+
docker compose -f tests/emulator_tests/utils/eventhub/docker-compose.yml pull
78+
docker compose -f tests/emulator_tests/utils/eventhub/docker-compose.yml up -d
79+
displayName: 'Install Azurite and Start EventHub Emulator'
80+
- bash: |
81+
python -m pytest -q -n auto --dist loadfile --reruns 4 --ignore=tests/emulator_tests/test_servicebus_functions.py tests/emulator_tests
82+
env:
83+
AzureWebJobsStorage: "UseDevelopmentStorage=true"
84+
AzureWebJobsEventHubConnectionString: "Endpoint=sb://localhost;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;"
85+
displayName: "Running $(PYTHON_VERSION) Python Linux Emulator Tests"
86+
- bash: |
87+
# Stop and remove EventHub Emulator container to free up the port
88+
docker stop eventhubs-emulator
89+
docker container rm --force eventhubs-emulator
90+
docker compose -f tests/emulator_tests/utils/servicebus/docker-compose.yml pull
91+
docker compose -f tests/emulator_tests/utils/servicebus/docker-compose.yml up -d
92+
env:
93+
AzureWebJobsSQLPassword: $(AzureWebJobsSQLPassword)
94+
displayName: 'Install Azurite and Start ServiceBus Emulator'
95+
- bash: |
96+
python -m pytest -q -n auto --dist loadfile --reruns 4 tests/emulator_tests/test_servicebus_functions.py
97+
env:
98+
AzureWebJobsStorage: "UseDevelopmentStorage=true"
99+
AzureWebJobsServiceBusConnectionString: "Endpoint=sb://localhost;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;"
100+
displayName: "Running $(PYTHON_VERSION) Python ServiceBus Linux Emulator Tests"

0 commit comments

Comments
 (0)