Skip to content

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

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

Merged
merged 18 commits into from
Jul 1, 2024
Merged
3 changes: 2 additions & 1 deletion eng/ci/public-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
59 changes: 58 additions & 1 deletion eng/templates/official/jobs/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -89,4 +145,5 @@ jobs:
AzureWebJobsSqlConnectionString: $(SQL_CONNECTION)
AzureWebJobsEventGridTopicUri: $(EVENTGRID_URI)
AzureWebJobsEventGridConnectionKey: $(EVENTGRID_CONNECTION)
USETESTPYTHONSDK: $(USETESTPYTHONSDK)
displayName: "Running $(PYTHON_VERSION) Python E2E Tests"
3 changes: 2 additions & 1 deletion tests/endtoend/test_dependency_isolation_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,15 @@ def test_paths_resolution(self):
).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
.python_packages_grpc_protobuf/ folder
"""
r: Response = self.webhost.request('GET', 'report_dependencies')
libraries = r.json()['libraries']

self.assertEqual(
libraries['proto.expected.version'], libraries['proto.version']
)
Expand Down
Loading