test: update pipeline to allow testing with dev libraries (#1520)

* sync with ADO changes

* removed specific build id

* test commit

* test commit

* latest dev run

* latest from branch

* latest

* skip build tagging for public build

* print debugging info

* added ext and sdk pipeline resources

* maxDiff = None

* variable passing for sdk

* revert variable group

* latest for sdk

* skip dep isolation test

* specified project name

* missed ref

* missed ref

---------

Co-authored-by: Victoria Hall <victoria.hall@microsoft.com>
This commit is contained in:
hallvictoria 2024-07-01 17:07:30 -05:00 коммит произвёл GitHub
Родитель fd390606b9
Коммит e87a31aed4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 62 добавлений и 3 удалений

Просмотреть файл

@ -36,7 +36,8 @@ extends:
compiled:
enabled: true # still only runs for default branch
runSourceLanguagesInSourceAnalysis: true
settings:
skipBuildTagsForGitHubPullRequests: ${{ variables['System.PullRequest.IsFork'] }}
stages:
- stage: Build
jobs:

Просмотреть файл

@ -77,8 +77,64 @@ jobs:
python setup.py build
python setup.py webhost --branch-name=dev
python setup.py extension
mkdir logs
displayName: 'Install dependencies and the worker'
condition: and(eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
- task: DownloadPipelineArtifact@2
displayName: 'Download Python SDK Artifact'
inputs:
buildType: specific
artifactName: 'azure-functions'
project: 'internal'
definition: 679
buildVersionToDownload: latest
targetPath: '$(Pipeline.Workspace)/PythonSdkArtifact'
condition: eq(variables['USETESTPYTHONSDK'], true)
- bash: |
python -m pip install --upgrade pip
python -m pip install -e $(Pipeline.Workspace)/PythonSdkArtifact
python -m pip install -U -e .[dev]
if [[ $(PYTHON_VERSION) != "3.7" ]]; then
python -m pip install --pre -U -e .[test-http-v2]
fi
if [[ $(PYTHON_VERSION) != "3.7" && $(PYTHON_VERSION) != "3.8" ]]; then
python -m pip install --pre -U -e .[test-deferred-bindings]
fi
python setup.py build
python setup.py webhost --branch-name=dev
python setup.py extension
displayName: 'Install test python sdk, dependencies and the worker'
condition: eq(variables['USETESTPYTHONSDK'], true)
- task: DownloadPipelineArtifact@2
displayName: 'Download Python Extension Artifact'
inputs:
buildType: specific
artifactName: $(PYTHONEXTENSIONNAME)
project: 'internal'
definition: 798
buildVersionToDownload: latest
targetPath: '$(Pipeline.Workspace)/PythonExtensionArtifact'
condition: eq(variables['USETESTPYTHONEXTENSIONS'], true)
- bash: |
python -m pip install --upgrade pip
if [[ $(PYTHON_VERSION) != "3.7" ]]; then
python -m pip install -e $(Pipeline.Workspace)/PythonExtensionArtifact
python -m pip install --pre -U -e .[test-http-v2]
fi
if [[ $(PYTHON_VERSION) != "3.7" && $(PYTHON_VERSION) != "3.8" ]]; then
python -m pip install -e $(Pipeline.Workspace)/PythonExtensionArtifact
python -m pip install --pre -U -e .[test-deferred-bindings]
fi
python -m pip install -U -e .[dev]
python setup.py build
python setup.py webhost --branch-name=dev
python setup.py extension
displayName: 'Install test python extension, dependencies and the worker'
condition: eq(variables['USETESTPYTHONEXTENSIONS'], true)
- bash: |
python -m pytest -q -n auto --dist loadfile --reruns 4 --cov=./azure_functions_worker --cov-report xml --cov-branch --cov-append tests/endtoend tests/extension_tests/deferred_bindings_tests tests/extension_tests/http_v2_tests
env:
@ -89,4 +145,5 @@ jobs:
AzureWebJobsSqlConnectionString: $(SQL_CONNECTION)
AzureWebJobsEventGridTopicUri: $(EVENTGRID_URI)
AzureWebJobsEventGridConnectionKey: $(EVENTGRID_CONNECTION)
USETESTPYTHONSDK: $(USETESTPYTHONSDK)
displayName: "Running $(PYTHON_VERSION) Python E2E Tests"

Просмотреть файл

@ -118,6 +118,8 @@ class TestGRPCandProtobufDependencyIsolationOnDedicated(
).lower()
)
@skipIf(is_envvar_true('USETESTPYTHONSDK'),
'Running tests using an editable azure-functions package.')
def test_loading_libraries_from_customers_package(self):
"""Since the Python now loaded the customer's dependencies, the
libraries version should match the ones in
@ -125,7 +127,6 @@ class TestGRPCandProtobufDependencyIsolationOnDedicated(
"""
r: Response = self.webhost.request('GET', 'report_dependencies')
libraries = r.json()['libraries']
self.assertEqual(
libraries['proto.expected.version'], libraries['proto.version']
)