Skip to content
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

test: pin to extension versions when testing #1594

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
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
21 changes: 20 additions & 1 deletion eng/templates/official/jobs/ci-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,25 @@ jobs:
eng/scripts/test-setup.sh
displayName: 'Install test python extension, dependencies and the worker'
condition: or(eq(variables.isExtensionsRelease, true), eq(variables['USETESTPYTHONEXTENSIONS'], true))
- powershell: |
$pipelineVarSet = "$(USETESTPYTHONSDK)"
Write-Host "pipelineVarSet: $pipelineVarSet"
$branch = "$(Build.SourceBranch)"
Write-Host "Branch: $branch"
if($branch.StartsWith("refs/heads/sdk/") -or $pipelineVarSet -eq "true")
{
Write-Host "##vso[task.setvariable variable=skipDependencyIsolationTests;]true"
}
else
{
Write-Host "##vso[task.setvariable variable=skipDependencyIsolationTests;]false"
}
displayName: 'Set SkipDependencyIsolationTests variable'
condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true))
- powershell: |
Write-Host "skipDependencyIsolationTests: $(skipDependencyIsolationTests)"
displayName: 'Display SkipDependencyIsolationTests variable'
condition: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], 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 @@ -125,5 +144,5 @@ jobs:
AzureWebJobsSqlConnectionString: $(SQL_CONNECTION)
AzureWebJobsEventGridTopicUri: $(EVENTGRID_URI)
AzureWebJobsEventGridConnectionKey: $(EVENTGRID_CONNECTION)
USETESTPYTHONSDK: or(eq(variables.isSdkRelease, true), eq(variables['USETESTPYTHONSDK'], true))
skipDependencyIsolationTests: $(skipDependencyIsolationTests)
displayName: "Running $(PYTHON_VERSION) Python E2E Tests"
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ dev = [
"invoke"
]
test-http-v2 = [
"azurefunctions-extensions-http-fastapi",
"azurefunctions-extensions-http-fastapi==1.0.0b1",
"ujson",
"orjson"
]
test-deferred-bindings = [
"azurefunctions-extensions-bindings-blob"
"azurefunctions-extensions-bindings-blob==1.0.0b2"
]

[build-system]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,55 @@ def put_get_multiple_blobs_as_bytes_return_http_response(
mimetype="application/json",
status_code=200
)


@app.function_name(name="blob_trigger_default_source_enum")
@app.blob_trigger(arg_name="file",
path="python-worker-tests/test-blob-trigger.txt",
connection="AzureWebJobsStorage",
source=func.BlobSource.LOGS_AND_CONTAINER_SCAN)
def blob_trigger_default_source_enum(file: func.InputStream) -> str:
return json.dumps({
'name': file.name,
'length': file.length,
'content': file.read().decode('utf-8')
})


@app.function_name(name="blob_trigger_eventgrid_source_enum")
@app.blob_trigger(arg_name="file",
path="python-worker-tests/test-blob-trigger.txt",
connection="AzureWebJobsStorage",
source=func.BlobSource.EVENT_GRID)
def blob_trigger_eventgrid_source_enum(file: func.InputStream) -> str:
return json.dumps({
'name': file.name,
'length': file.length,
'content': file.read().decode('utf-8')
})


@app.function_name(name="blob_trigger_default_source_str")
@app.blob_trigger(arg_name="file",
path="python-worker-tests/test-blob-trigger.txt",
connection="AzureWebJobsStorage",
source="LogsAndContainerScan")
def blob_trigger_default_source_str(file: func.InputStream) -> str:
return json.dumps({
'name': file.name,
'length': file.length,
'content': file.read().decode('utf-8')
})


@app.function_name(name="blob_trigger_eventgrid_source_str")
@app.blob_trigger(arg_name="file",
path="python-worker-tests/test-blob-trigger.txt",
connection="AzureWebJobsStorage",
source="EventGrid")
def blob_trigger_eventgrid_source_str(file: func.InputStream) -> str:
return json.dumps({
'name': file.name,
'length': file.length,
'content': file.read().decode('utf-8')
})
2 changes: 1 addition & 1 deletion tests/endtoend/test_dependency_isolation_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_paths_resolution(self):
).lower()
)

@skipIf(is_envvar_true('USETESTPYTHONSDK'),
@skipIf(is_envvar_true('skipDependencyIsolationTests'),
'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
Expand Down
Loading